Sliding Window Fixed Size Others¶
Table of Contents¶
- 2269. Find the K-Beauty of a Number (Easy)
- 1984. Minimum Difference Between Highest and Lowest of K Scores (Easy)
- 220. Contains Duplicate III (Hard)
2269. Find the K-Beauty of a Number¶
-
LeetCode | LeetCode CH (Easy)
-
Tags: math, string, sliding window
2269. Find the K-Beauty of a Number - Python Solution
def divisorSubstrings(num: int, k: int) -> int:
numStr = str(num)
n = len(numStr)
res = 0
for i in range(n - k + 1):
x = int(numStr[i : i + k])
if x > 0 and num % x == 0:
res += 1
return res
num = 240
k = 2
print(divisorSubstrings(num, k)) # 2
1984. Minimum Difference Between Highest and Lowest of K Scores¶
-
LeetCode | LeetCode CH (Easy)
-
Tags: array, sliding window, sorting
220. Contains Duplicate III¶
-
LeetCode | LeetCode CH (Hard)
-
Tags: array, sliding window, sorting, bucket sort, ordered set