ashishranjan2828's blog

By ashishranjan2828, history, 8 years ago, In English

problem is http://www.spoj.com/problems/MAX_NUM/

Actually i'm trying this problem for long time but ends up clueless.....

any kind of help..

  • Vote: I like it
  • +12
  • Vote: I do not like it

| Write comment?
»
8 years ago, # |
Rev. 2   Vote: I like it +25 Vote: I do not like it

It is very easy if you get it. Simply search in the number for the first position i where n[i] < n[i+1] (n[i] is the digit in the ith position) and delete it. Just a simple greedy strategy, but be aware of the boundary cases.