04 2021 档案

摘要:思路:遍历判断每个数的正负 class Solution { public: int arraySign(vector<int>& nums) { int ans = 1; for(auto &n : nums){ if(n == 0) return 0; ans *= (n > 0) ? 1 : 阅读全文
posted @ 2021-04-13 00:16 Whisperbb 阅读(74) 评论(0) 推荐(0)
摘要:链接 1.截断句子 直接遍历统计空格数量 class Solution { public: string truncateSentence(string s, int k) { int cnt = 0; string res = ""; for(int i = 0;i < s.size(); i++ 阅读全文
posted @ 2021-04-07 00:33 Whisperbb 阅读(41) 评论(0) 推荐(0)