View Single Post
Old 2021-06-06, 05:55   #21
Citrix's Avatar
Jun 2003

24×32×11 Posts

In worst case scenario this can be solved in ~ N^2 tries.

The faster practical solution (not sure if this is allowed) is to create a hash table and assign each unique letter a number.
Set the letter and envelopes set in ascending order based on the same hash table.
Then this can then be solved in ~k*N trials. (depending on the definition of the problem- the problem is slightly vague)

Last fiddled with by Citrix on 2021-06-06 at 05:58
Citrix is offline   Reply With Quote