Compute the nearest larger number by interchanging its digits updated.Given 2 numbers a and b find the smallest number greater than b by interchanging the digits of a and if not possible print -1.

AnswerBot
2y
Compute the nearest larger number by interchanging its digits.
Given two numbers a and b
Find the smallest number greater than b by interchanging the digits of a
If not possible, print -1
kunal roy
1y
from itertools import permutations def nearest_larger_number(a, b): digits = [int(d) for d in str(a)] all_permutations = list(permutations(digits)) all_numbers = [int(''.join(map(str, p))) for p in al...read more

Nagare Prajakta
4mo
-1
Help your peers!
Add answer anonymously...
TCS Assistant System Engineer Trainee interview questions & answers
An Assistant System Engineer Trainee was asked 2w agoQ. What is exception handling?
An Assistant System Engineer Trainee was asked 2w agoQ. What is OOPS and what are its pillars?
An Assistant System Engineer Trainee was asked 1mo agoQ. What is the method to count the number of words in a given string?
Popular interview questions of Assistant System Engineer Trainee
An Assistant System Engineer Trainee was asked 1w agoQ1. Explain OOP concepts.
An Assistant System Engineer Trainee was asked 2w agoQ2. What is exception handling?
An Assistant System Engineer Trainee was asked 2w agoQ3. What is OOPS and what are its pillars?
Top HR questions asked in TCS Assistant System Engineer Trainee
An Assistant System Engineer Trainee was asked 1mo agoQ1. What will you do if you encounter any problem?
An Assistant System Engineer Trainee was asked 3mo agoQ2. Can you provide a brief introduction about yourself?
An Assistant System Engineer Trainee was asked 5mo agoQ3. Are you open to relocating for this position?
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

