Please read the new rule regarding the restriction on the use of AI tools. ×

Largest number using k swaps
Difference between en1 and en2, changed 51 character(s)
Given a number n, how to perform atmost k swap operations on number's digits to get the largest number.
Ex- n=7899, k=2↵
ans=9987

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English code_fille 2015-06-29 22:02:58 51
en1 English code_fille 2015-06-29 20:23:38 107 Initial revision (published)