Skip to content

Commit 26fd993

Browse files
committed
Runtime: 548 ms (Top 98.07%) | Memory: 27.7 MB (Top 73.31%)
1 parent 4fda393 commit 26fd993

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
# Runtime: 548 ms (Top 98.07%) | Memory: 27.7 MB (Top 73.31%)
12
class Solution:
23
def longestSubsequence(self, arr: List[int], difference: int) -> int:
34
d = defaultdict(int)
45
for num in arr:
56
if num - difference in d:
6-
d[num] = d[num - difference] + 1
7+
d[num] = d[num - difference] + 1
78
else:
89
d[num] = 1
910
return max((d[x] for x in d))
10-

0 commit comments

Comments
 (0)