}intutill(vector<int>& v, vector<vector<int>> &dp,inti,intj){if(i > j)return0;if(dp[i][j] != -1)returndp[i][j];inta = v[i] + min(utill(v,dp, i+1, j-1), utill(v, dp, i+2, j));intb = v[j] + min(utill(v,dp,i, j-2), utill(v,dp, i+1, j-1)...
按分钟和小时计算即可。 classSolution{publicintconvertTime(String current, String correct){ String[] current_spilt = current.split(":"), correct_split = correct.split(":");intdiff_hour=Integer.valueOf(correct_split[0]) - Integer.valueOf(current_spilt[0]);intdiff_minute=Integer.valueOf(corre...
append(str2time(time)) ans = [] for name, timelist in cache.items(): n = len(timelist) timelist = sorted(timelist) for i in range(n-2): if timelist[i+2] - timelist[i] <= 60: ans.append(name) break return sorted(ans)...
每周参加weekly contest,发现前几名都会在半小时左右完成4题,我感觉对于一道陌生的MEDIUM题目,理解+思考...
https://leetcode.cn/contest/weekly-contest-400/problems/minimum-number-of-chairs-in-a-waiting-room/ 题意 直接枚举 思路 统计当前字符串中最大的E的统计数目即可,与多任务CPU类似。 复杂度分析: 时间复杂度:O(n \log n), 其中n表示数组的长度。
LeetCode笔记:Weekly Contest 203 比赛记录 0. 赛后总结 昨天刚刚历史性地第一次打进了前500,今天转头就历史性地打进了前200,实在是有点开心。 不过说到底还是因为题目比较简单的关系,看了一下,前头的大佬们都是10分钟左右就做完的,实在不认为这次的题目比较难。
128th LeetCode Weekly Contest Pairs of Songs With Total Durations Divisible by 60,Inalistofsongs,the i-th songhasadurationof time[i] seconds.Returnthenumberofpairsofsongsforwhichtheirtotal durationinsecondsis
113th LeetCode Weekly Contest Largest Time for Given Digits,Givenanarrayof4digits,returnthelargest24hourtimethatcanbemade.Thesmallest24hourtimeis00:00,andthelargestis23:59.Startingf
Algorithms Exercise: LeetCode Problems, LeetCode Weekly Contest etc. github.com/caipengbo/LeetCode-CPP Resources Readme Activity Stars 56 stars Watchers 6 watching Forks 17 forks Report repository Releases No releases published Packages No packages published Languages Java 99.9% C++ 0.1...
给你一个字符串 s,找出它的所有子串并按字典序排列,返回排在最后的那个子串。 示例1: 输入:"abab" 输出:"bab" 解释:我们可以找出 7 个子串 ["a", "ab", "aba", "abab", "b", "ba", "bab"]。按字典序排在最后的子串是 "bab"。