Get Maximum in Generated Array - Practice Coding | SlaveCode
0
0123456789
0
0123456789
:
0
0123456789
0
0123456789
1646. Get Maximum in Generated Array
Easy
10 Points
Array
Simulation
You are given an integer n. A 0-indexed integer array nums of length n + 1 is generated in the following way:
Return the maximum integer in the array nums.
Input: n = 2
Output: 1
Explanation: According to the given rules, nums = [0,1,1]. The maximum is max(0,1,1) = 1.
Example 3
Input: n = 3
Output: 2
Explanation: According to the given rules, nums = [0,1,1,2]. The maximum is max(0,1,1,2) = 2.
Constraints
0 <= n <= 100
1646. Get Maximum in Generated Array
Easy
10 Points
Array
Simulation
You are given an integer n. A 0-indexed integer array nums of length n + 1 is generated in the following way:
Return the maximum integer in the array nums.