code_fille's blog

By code_fille, history, 9 years ago, In English

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

  • Vote: I like it
  • -4
  • Vote: I do not like it

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

do you mean if number is say 12345 and swaps = 2 , then find largest number ? your question format is very bad

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by code_fille (previous revision, new revision, compare).

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Doesn't it look like bruteforce? I mean the for n <= 10^18, and k small enough (does big K even make sense?)