Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
442 views
in Online Assessments by Expert (46,090 points) | 442 views

1 Answer

0 like 0 dislike

Given integer N, find the smallest larger number that doesn't have the same two digits in consecutive positions.

 

Example: N = 76.
Answer: 78. Explanation -> 77 is the smallest larger number after 76 but hence we havedigit 7 in two consecuitive positions, that doesn't satisify our condition.

 

Note:N=766 -> answer should be 767, the number digits don't need to be unique, only they have not to be in consecutive positions.

by Expert (46,090 points)