def maxJumps(self,A,d):
n=len(A)
dp=[1]*n
for a,i in sorted([a,i] for i,a in enumerate(A)):
for di in [-1,1]:
for j in range(i+di,i+d*di+di,di):
if not (0<=j<n and a[j]<a[i]): break
dp[i]=max(dp[i],dp[j]+1)
return max(dp)
jump games V
最新推荐文章于 2023-09-08 14:53:21 发布