祖传的手艺不想丢了,所以按顺序写一个leetcode的题解。计划每日两题,争取不卡题吧 2769.找出最大的可达成数字 力扣(LeetCode)官网 - 全球极客挚爱的技术成长平台leetcode.cn/problems/find-the-maximum-achievable-number/ 为了使得答案最大,那么每一步都应该是让答案减去1,然后让num加上1,最终使得二者相等,...
T1. 找出最大的可达成数字(Easy) https://leetcode.cn/problems/find-the-maximum-achievable-number/ 题解(模拟) 简单模拟题,在每一轮操作中可以将 num 加一,而对 x 减一,因此最大 x 就是 num + 2 * t。 classSolution{funtheMaximumAchievableX(num:Int, t:Int):Int{returnnum +2* t } } 复杂...
https://leetcode.cn/problems/find-the-maximum-achievable-number/ 题解(模拟) 简单模拟题,在每一轮操作中可以将 num 加一,而对 x 减一,因此最大 x 就是 num + 2 * t。 class Solution { fun theMaximumAchievableX(num: Int, t: Int): Int { return num + 2 * t } } 复杂度分析: 时间...
classSolution { publicint theMaximumAchievableX(int num, int t) { returnnum + 2 * t; } } 运行时间:1 毫秒,比 100.00% 的 java 在线提交的“查找最大可实现数字”快。 内存使用量:41.3 mb,低于 java 在线提交的“查找最大可实现数字”的 63.18%。 就是这样!如果还有什么要讨论的,请随时发表评论,...
2831. 找出最长等值子数组 Find the Longest Equal Subarray 力扣 LeetCode 题解 09:26 2225. 找出输掉零场或一场比赛的玩家 Find Players With Zero or One Losses 力扣 LeetCode 题解 04:24 2769. 找出最大的可达成数字 Find the Maximum Achievable Number 力扣 LeetCode 题解 02:03 1542. 找出最长...
找出最长等值子数组 Find the Longest Equal Subarray 力扣 LeetCode 题解 09:26 2225. 找出输掉零场或一场比赛的玩家 Find Players With Zero or One Losses 力扣 LeetCode 题解 04:24 2769. 找出最大的可达成数字 Find the Maximum Achievable Number 力扣 LeetCode 题解 02:03 1542. 找出最长的超赞子...
1657-find-the-winner-of-an-array-game 1666-make-the-string-great 1667-find-kth-bit-in-nth-binary-string 1675-magnetic-force-between-two-balls 1683-maximum-number-of-coins-you-can-get 169-majority-element 1691-minimum-number-of-days-to-disconnect-island 1700-minimum-time-to-make-rope-colorfu...
2769.find-the-maximum-achievable-number.cpp 2798.number-of-employees-who-met-the-target.cpp 2831.find-the-longest-equal-subarray.cpp 2903.find-indices-with-index-and-value-difference-i.cpp 2928.distribute-candies-among-children-i.cpp 2938.separate-black-and-white-balls.cpp 2951.find-the-peaks...
Returnthe maximum number of achievable requests. Example 1: Input: n = 5, requests = [[0,1],[1,0],[0,1],[1,2],[2,0],[3,4]] Output: 5 Explantion: Let's see the requests: From building 0 we have employees x and y and both want to move to building 1. ...
#1414.Find the Minimum Number of Fibonacci Numbers Whose Sum Is K (M+) 1600 #1432.Max Difference You Can Get From Changing an Integer (M-) 1400 #1520.Maximum Number of Non-Overlapping Substrings (H) 1900 #1540.Can Convert String in K Moves (M) 1500 #1591.Strange Printer II...