Write a program to insert a user inputted value ‘n’ into an array of maximum size ‘m’. Please help me
Answers
Answered by
1
Answer:
After m operations, we need to calculate the maximum of the values in the array.
Examples:
Input : n = 5 m = 3
a = 0, b = 1, k = 100
a = 1, b = 4, k = 100
a = 2, b = 3, k = 100
Output : 200
Explanation:
Initially array = {0, 0, 0, 0, 0}
After first operation:
array = {100, 100, 0, 0, 0}
After second operation:
array = {100, 200, 100, 100, 100}
After third operation:
array = {100, 200, 200, 200, 100}
Maximum element after m operations
is 200.
Similar questions
Social Sciences,
4 months ago
Science,
4 months ago
English,
4 months ago
Math,
10 months ago
Environmental Sciences,
10 months ago
Science,
1 year ago
Biology,
1 year ago