cards, and digits may repeat.
Pick any three cards and lay them out in a row in any order to form a three-digit number. We are interested in the numbers that:
- do not start with zero;
- are even.
Each card can be used only once per number, so a digit cannot appear in a number more often than it appears on the table.
Return all distinct such numbers in increasing order.cards=[4, 0, 5] → [450, 504, 540]
The even numbers without a leading zero are 450, 504 and 540. 405 is odd, and 045 and 054 start with zero.
cards=[6, 6, 1, 6] → [166, 616, 666]
There are three 6s and one 1: 166, 616 and 666. 661 is odd.
cards=[9, 1, 7, 3] → []
There is no even digit, so no even number can be made and the answer is empty.
cards.length ≤ 10⁴cards[i] ≤ 9cards=[4, 0, 5]
[450, 504, 540]
Run checks the first 3 tests in your browser. Submit checks all 94 tests on the server, hidden ones included.