classSolution { public: vector<int>sortedSquares(vector<int>&nums) { inti=0;intnum; num=nums.size(); for(i=0;i<num;i++){ nums[i]=nums[i]*nums[i]; } sort(nums.begin(), nums.end()); returnnums; } };
classSolution { public: vector<int>sortedSquares(vector<int>&nums) { inti=0;intnum; num=nums.size(); for(i=0;i<num;i++){ nums[i]=nums[i]*nums[i]; } sort(nums.begin(), nums.end()); returnnums; } };