about | help | code help+videos | done | prefs |
Write a method that accepts a positive integer parameter and returns that value as an integer, but "sorted" to have its digits in increasing order. For example, sortNum(72081) would return 1278 since the increasing order of the digits would be 0, 1, 2, 7, and 8, but the zero is not significant when placed as the first digit. There are several interesting ways of solving this problem, so you might want to look for alternative solutions after you solve it one way. sortNum(7823) → 2378 sortNum(18424) → 12448 sortNum(4000) → 4 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290
Copyright Nick Parlante 2017 - privacy