All problems
1038EasyArrayHash TableRecursionSortingEnumeration

Three-Digit Even Numbers From the Tiles

Tracked in this browser only
Write code

Trains the technique from

LeetCode 2094Finding 3-Digit Even Numbers

This is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.

Same function shape, different story and different numbers.

A tray holds tiles, each stamped with a single digit, given as tiles.

Form three-digit numbers by choosing three tiles and laying them out in some order. No tile may be used more often than the tray holds it, the number may not begin with a zero, and the number must be even.

Return every distinct number obtainable, in increasing order.

Examples

Example 1

Input
tiles = [1, 2, 4]
Output
[124, 142, 214, 412]

The three tiles must all be used. Of the six orders, only those ending on 2 or 4 are even, which gives four numbers.

Example 2

Input
tiles = [0, 0, 0]
Output
[]

Every tile is a zero, so any three-tile number would begin with a zero.

Example 3

Input
tiles = [4, 4, 4]
Output
[444]

Three tiles all stamped 4, so the only number is 444, which is even and does not begin with a zero.

Constraints

  • 3 <= tiles.length <= 100
  • 0 <= tiles[i] <= 9

The signature

The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.

Python
def find_even_numbers(tiles: list[int]) -> list[int]:
Java
public int[] findEvenNumbers(int[] tiles)
September 7
Apply