Get best answers to any doubt/query/question related to programming , jobs, gate, internships and tech-companies. Feel free to ask a question and you will receive the best advice/suggestion related to anything you ask about software-engineering , development and programming problems .

0 like 0 dislike
886 views
in Online Assessments by Expert (44,360 points)

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 (44,360 points)
...