Search
⌘K

Leetcode 1646. Get Maximum in Generated Array

Generate an array nums of length n+1 using the recurrence nums[0]=0, nums[1]=1, nums[2*i]=nums[i], nums[2*i+1]=nums[i]+nums[i+1] (even indices copy, odd indices sum) and return the maximum value in nums; n≤100 so a straightforward O(n) construction suffices.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.