InterviewBit Academy is now Scaler!
InterviewBit Academy is now Scaler Academy!

An Increment Problem

Problem Description

Given a stream of numbers A. On arrival of each number, you need to increase its first occurence by 1 and include this in the stream.

Return the final stream of numbers.



Problem Constraints

1 <= |A| <= 100000

1 <= A[i] <= 10000



Input Format

First and only argument is the array A.



Output Format

Return an array, the final stream of numbers.



Example Input

Input 1:

A = [1, 1]

Input 2:

A = [1, 2]



Example Output

Output 1:

[2, 1]

Output 2:

[1, 2]



Example Explanation

Explanation 1:

 On arrival of the second element, the other element is increased by 1.

Explanation 2:

No increases are to be done.



NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving An Increment Problem on Interview Code Editor
Sign Up
to access hints and editorial solutions for An Increment Problem

Discussion


Loading...
Click here to start solving coding interview questions