Can some one Solve this

You wrote a special number D on the blackboard.But you mistakenly erased it.Fortunately you have written down the relation between consecutive digits of the number.Lets denote the ith digit of D as D[i]

You are given an array having N elements .The original number D has N+1 digits.

A[i] denotes relation between digits D[i] and D[i+1].
If A[i] is -1 then D[i]<D[i+1]
if A[i] is 0 then D[i]=D[i+1]
if A[i] is 1 then D[i]>D[i+1].

Calculate the largest number D according to A.
Constraints:1<=N<=10^5

Sample test cases: input: A=[1,-1,1]
output:9898

						input: A=[1,0,-1,-1]
						output :87789
						
						
						input:A=[1,1,1,-1,-1]
						output:987689
Comments (1)