Skip to content

Commit 8c4c0e2

Browse files
committed
Had to copy but thoda thoda samajh aya , i need to fucking up my dp game guys, aight babes on my way to master dp hell yeah
1 parent 0c1e5ec commit 8c4c0e2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution:
2+
def longestArithSeqLength(self, nums: List[int]) -> int:
3+
4+
d = {}
5+
6+
for i in range(len(nums)):
7+
for j in range(i+1,len(nums)):
8+
diff = nums[j]-nums[i]
9+
d[j,diff] = d.get((i,diff),1) +1
10+
11+
return max(d.values())

0 commit comments

Comments
 (0)