problem
977. Squares of a Sorted Array
solution:
class Solution { public: vector<int> sortedSquares(vector<int>& A) { for(auto &a:A) a *=a; sort(A.begin(), A.end()); return A; } };
参考
1. Leetcode_easy_977. Squares of a Sorted Array;
完
原文地址:https://www.cnblogs.com/happyamyhope/p/11316933.html
时间: 2024-10-02 03:29:50