1646. Get Maximum in Generated Array
https://leetcode.com/problems/get-maximum-in-generated-array
Description
You are given an integer n
. An array nums
of length n + 1
is generated in the following way:
nums[0] = 0
nums[1] = 1
nums[2 * i] = nums[i]
when2 <= 2 * i <= n
nums[2 * i + 1] = nums[i] + nums[i + 1]
when2 <= 2 * i + 1 <= n
Returnthe maximum integer in the array nums
.
Example 1:
Example 2:
Example 3:
Constraints:
0 <= n <= 100
ac
Previous1645. Hopper Company Queries IINext1647. Minimum Deletions to Make Character Frequencies Unique
Last updated