llllmz

导航

2024年9月8日

977. 有序数组的平方

摘要: sort 一下 class Solution { public: vector<int> sortedSquares(vector<int>& nums) { vector<int> ret; for(int num : nums){ ret.push_back(pow(num, 2)); } so 阅读全文

posted @ 2024-09-08 16:47 神奇的萝卜丝 阅读(12) 评论(0) 推荐(0)

844. 比较含退格的字符串

摘要: c++字符串还是不太熟练 class Solution { public: bool backspaceCompare(string s, string t) { return dealString(s) == dealString(t); } private: string dealString( 阅读全文

posted @ 2024-09-08 16:37 神奇的萝卜丝 阅读(26) 评论(0) 推荐(0)

283. 移动零

摘要: class Solution { public: void moveZeroes(vector<int>& nums) { int head = 0, curIndex = 0; for(; curIndex < nums.size(); ++curIndex){ if(nums[curIndex] 阅读全文

posted @ 2024-09-08 16:28 神奇的萝卜丝 阅读(14) 评论(0) 推荐(0)