Editorial for LCC '21 Contest 1 S1 - Password Please


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.

Author: AlanL

Because there are only 9 possible numbers for each digit (1 to 9 since Alan does not like 0), and the password has to be 5 digits, a nested loop of 5 for loops from 1 to 9 is able to pass. You can also guarantee the lexicographically smallest solution by breaking out of the loops once you get a correct answer.


Comments

There are no comments at the moment.