AI代码解释 classSmallestInfiniteSet:def__init__(self):self.nums=[iforiinrange(1,1001)]self.max_elem=1000defpopSmallest(self)->int:ifself.nums==[]:self.nums=[i+self.max_elemforiinrange(1,1001)]self.max_elem+=1000returnself.nums.pop(0)defaddBack(self,num:int)->None:whilenum>self...
LeetCode Weekly Contest 40解题思路 LeetCode Weekly Contest 40解题思路 详细代码可以fork下Github上leetcode项目,不定期更新。 赛题 本次周赛主要分为以下4道题: Leetcode 637. Average of Levels in Binary Tree Leetcode 640. Solve the Equation Leetcode 638. Shopping Offers Leetcode 639. Decode Ways I...
LeetCode Weekly Contest 6 leetcode现在每周末举办比赛,这是今天上午参加的比赛的题解。 题目难度不算大,两个easy,一个medium,一个hard。hard题之前接触过,所以做得比较顺利。 1. Sum of Left Leaves(Leetcode 404 Easy) Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 2...
LeetCode Weekly Contest 8 LeetCode每周末举办比赛,这是今天上午比赛的题解。 1. Add Strings (LeetCode 415 Easy) Given two non-negative numbersnum1andnum2represented as string, return the sum ofnum1andnum2. Note: The length of bothnum1andnum2is < 5100. Bothnum1andnum2contains only digits0...
leetcode weekly contest 398 连续两周难的题目,又变成简单题目了,T4 确实太暴力模板了。 100310. 特殊数组 I 如果数组的每一对相邻元素都是两个奇偶性不同的数字,则该数组被认为是一个 特殊数组。 Aging 有一个整数数组 nums。如果 nums 是一个 特殊数组 ,返回 true,否则返回 false。 示例1: 输入:nums ...
Weekly Contest 361 第三题:2845 Count of Interesting Subarrays 题意分析: 思路分析: Weekly Contest 362 第三题:2850. Minimum Moves to Spread Stones Over Grid Biweekly Contest 113 异或运算具有互推性【泪目:完美的简洁解法】2857.Count Pairs of Points With Distance k Weekly Contest 363 第三题: 题...
上岸I LeetCode Weekly Contest 207解题报告 说明:题解来源于上岸算法公众号【北美上岸君】** No.1 重新排列单词间的空格 解题思路 详解可以看下方代码注释。 代码展示 class Solution { public String reorderSpaces(String text) { // 提取单词列表 String[] words = text.trim().split(" +");...
Welcome toBiweekly Contest 43! Feel free to share and post your contest experience here! You can also view the rankings for the contesthere. Links to the individual problems are included below: Calculate Money in Leetcode Bank(3 points) ...
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...
OfficialContest Welcome to Biweekly Contest 35! Feel free to share and post your contest experience here! You can also view the rankings for the contest here. Links to the individual problems are included below: Sum of All Odd Length Subarrays (3 points) Maximum Sum Obtained of Any Permutati...