[READ-ONLY] Mirror of https://github.com/shuuji3/leetcode. ๐Ÿ“ƒ Code submitted to LeetCode leetcode.com/shuuji3/
leetcode leetcode-solutions
0

Configure Feed

Select the types of activity you want to include in your feed.

Add solutions and note for Weekly Contest 168.

+35
+4
weekly-contest-168/5291.find-numbers-with-even-number-of-digits.py
··· 1 + class Solution: 2 + def findNumbers(self, nums: List[int]) -> int: 3 + digits_list = map(str, nums) 4 + return len(list(filter(lambda s: len(s) % 2 == 0, digits_list)))
+16
weekly-contest-168/5292.divide-array-in-sets-of-k-consecutive-numbers.tle.py
··· 1 + class Solution: 2 + def isPossibleDivide(self, nums: List[int], k: int) -> bool: 3 + # In case of non multiple 4 + if len(nums) % k != 0: 5 + return False 6 + 7 + sorted_nums = sorted(nums) 8 + for _ in range(len(nums) // k): 9 + first_num = sorted_nums[0] 10 + for i in range(k): 11 + target_num = first_num + i 12 + if target_num in sorted_nums: 13 + sorted_nums.pop(sorted_nums.index(target_num)) 14 + else: 15 + return False 16 + return True
+12
weekly-contest-168/5293.maximum-number-of-occurrences-of-a-substring.wa.py
··· 1 + class Solution: 2 + def maxFreq(self, s: str, maxLetters: int, minSize: int, maxSize: int) -> int: 3 + substring_count = 0 4 + for start in range(len(s) - minSize + 1): 5 + for end in range(start + minSize - 1, start + maxSize): 6 + substring = s[start:end+1] 7 + letters_num = len(set(substring)) 8 + if letters_num <= maxLetters: 9 + substring_count += 1 10 + else: 11 + break 12 + return substring_count
+3
weekly-contest-168/note.md
··· 1 + # Note for Weekly Contest 168 2 + 3 + I tried to solve from #1591 to #1593 but can pass #5291 for all testcase. #1592 hit TLE but I didn't come up with the way to reduce time complexities. For #1593, I didn't make sense for the required solution.