Loading

摘要: 思路 方法:哈希表 1 class Solution { 2 public: 3 int leastBricks(vector<vector<int>>& wall) { 4 unordered_map<int, int> mp; 5 for(int i = 0; i < wall.size(); 阅读全文
posted @ 2021-02-27 18:32 拾月凄辰 阅读(55) 评论(0) 推荐(0) 编辑
摘要: 思路 方法:前缀和 记数组的全部元素之和为sum,当遍历到第 i 个元素时,设其左侧元素之和为 tmpSum,则其右侧元素之和为 sum-nums[i]-tmpSum。左右侧元素相等即为 tmpSum = sum-nums[i]-tmpSum。 1 class Solution { 2 public 阅读全文
posted @ 2021-02-27 18:01 拾月凄辰 阅读(41) 评论(0) 推荐(0) 编辑
摘要: 思路 1 class Solution { 2 public: 3 bool judgePoint24(vector<int>& nums) { 4 vector<double> digits; 5 for (int num : nums) { 6 digits.push_back((double) 阅读全文
posted @ 2021-02-27 16:06 拾月凄辰 阅读(65) 评论(0) 推荐(0) 编辑