8000 Create December-09.py · Hunterdii/Leetcode-POTD@1602c4a · GitHub
[go: up one dir, main page]

Skip to content

Commit 1602c4a

Browse files
authored
Create December-09.py
1 parent c2447c6 commit 1602c4a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Solution:
2+
def isArraySpecial(self, nums: List[int], queries: List[List[int]]) -> List[bool]:
3+
n = len(nums)
4+
d = list(range(n))
5+
for i in range(1, n):
6+
if nums[i] % 2 != nums[i - 1] % 2:
7+
d[i] = d[i - 1]
8+
return [d[t] <= f for f, t in queries]

0 commit comments

Comments
 (0)
0