Smallest Greater Number from Digits
Given a list of digits and a lower bound string of equal length, construct the smallest possible number from those digits that is greater than or equal to the lower bound.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid July, 2026
Late May, 2026
Given a list of digits and a lower bound, build the smallest number you can from those digits that is greater than or equal to the lower bound. Note: the size of the list of digits is ALWAYS equal to the length of lower bound Examples: * Digits: 6, 5, 1; lower bound: "100" * Answer: "156" * Digits: 6, 5, 1; lower bound: "200" * Answer: “516” * Digits: 1,2,3,4; lower_bound: "1300" * Answer: "1324" * Digits: 1,1,2,3; lower_bound: "1322" * Answer: "2113" * Digits: 1, 3, 3, 3, 3, .... (100 "3"s) ; lower bound: "13...34", 99 "3"s between 1 and 4 * Answer: "313..3", 99 tailing "3"s
Hello Interview Premium
Your account is free and you can post anonymously if you choose.