祖传的手艺不想丢了,所以按顺序写一个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 } } 复杂...
18 changes: 18 additions & 0 deletions 18 2769.find-the-maximum-achievable-number.py Original file line numberDiff line numberDiff line change @@ -0,0 +1,18 @@ # # @lc app=leetcode id=2769 lang=python # # [2769] Find the Maximum Achievable Number # # @lc code=start class Solut...
https://leetcode.cn/contest/weekly-contest-353/problems/find-the-maximum-achievable-number/ 题意 直接模拟 思路 最大值一定是x每次减1,num每次加1,此时经过t次操作后,可以知道满足x−t=num+t,可以得到最终结果x=num+2t。 复杂度分析: 时间复杂度:O(1)。 空间复杂度:O(1)。 代码 class Solution {...
找出最长等值子数组 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. 找出最长的超赞子...
2571-find-the-pivot-integer 2608-count-the-digits-that-divide-a-number 2624-difference-between-element-sum-and-digit-sum-of-an-array 2752-sum-multiples 2812-find-the-maximum-achievable-number 3172-divisible-and-non-divisible-sums-difference 3371-harshad-number 3476-find-minimum-operations-to-make...
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. ...
2769. 找出最大的可达成数字 Find the Maximum Achievable Number 力扣 LeetCode 题解 02:03 1542. 找出最长的超赞子字符串 Find Longest Awesome Substring 力扣 LeetCode 题解 20:29 1535. 找出数组游戏的赢家 Find the Winner of an Array Game 力扣 LeetCode 题解 05:46 2644. 找出可整除性得分最...
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...