Sai Likhith Adari
Sai Likhith Adari

Reputation: 11

Largest number closest to Y

I have two integers "X" and "Y" where X > Y, I want to find a closest larger number to Y, which is obtained by deleting zero or more digits from X, by keeping the order of digits intact.

for example: X = 4186 and Y = 11. Here by deleting 4 and 8, we left with 16, which is closest larger number to Y i.e., 11.

Can anyone help me to get the problem approach to solve?

Upvotes: 1

Views: 35

Answers (0)

Related Questions