码迷,mamicode.com
首页 > 其他好文 > 详细

【Leetcode_easy】977. Squares of a Sorted Array

时间:2019-08-07 19:05:06      阅读:64      评论:0      收藏:0      [点我收藏+]

标签:href   ble   tps   turn   int   col   get   for   auto   

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;

【Leetcode_easy】977. Squares of a Sorted Array

标签:href   ble   tps   turn   int   col   get   for   auto   

原文地址:https://www.cnblogs.com/happyamyhope/p/11316933.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!