All Posts
Leetcode 1646: Get Maximum in Generated Array
Given an integer n, an array nums of length n+1 is generated with the following rules:
- nums[0] = 0
- nums[1] = 1
- nums[2 * i] = nums[i] when 2 <= 2 * i <= n
- nums[2 * i + 1] = nums[i] + nums[i + 1] when 2 <= 2 * i + 1 <= n
Return the maximum value in the array nums.