report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
Smallest possible - FlandreOJ: Flandre Online Judge

Smallest possible

Time limit: 1000 ms
Memory limit: 256 MB
You are given an integer $n$. What is the smallest number you can have by rearranging digits in $n$? Note: Leading zeros is not allowed. ### Input - A single integer $n$. ### Output - Print an integer which is the largest number you can have. ### Constraints - $1 \le n \le 10^{5000000}$. ### Example Input: ``` 3210 ``` Output: ``` 1023 ``` **Bonus: Solve this problem using an algorithm with $\mathcal{O}(n)$ time complexity.**
Sorting
Points Sorting
Brewing potion
Smallest possible
Distance minimization
Segment
Cucumber
Maximum value arrangement
Buttons game
Building fence
Balance
Topic
Sorting
Rating 900
Solution (2) Solution