Software Engineering Test Identity
Software Engineering Test Identity
The problem
This problem is related to the Hungarian lo ery. In case you are not familiar with it: players pick 5
dis nct numbers from 1 to 90. There is a weekly lo ery picking event when the lo o organiza on
picks 5 dis nct numbers randomly between 1 and 90 – just like the players did. The player’s
reward then depends on how many of the player’s numbers match with the ones selected at the
lo o picking. A player wins if he/she has 2, 3, 4 or 5 matching numbers.
Now, the problem: at the lo ery event, right a er picking the numbers, a computer shall be able
to report quickly that how many winners are in each category, for example:
5 1
4 1221
3 81843
2 1226135
This report shall be generated as fast as possible a er picking the winner number. The player’s
numbers are known in advance which is expected to reach tens of millions.
Technical speci ca on
Write a console applica on in a freely chosen programming language that can be compiled on Linux.
Your applica on will be called like this:
./yourapp input.txt
where input.txt le exists in the same folder and is an ascii le, in which each line contains 5
space separated integers (in the range of 1-90) represen ng one player’s numbers.
You can download a sample le here.
When your applica on nished processing the player’s dataset from the le, it should write a line
to the standard output like this:
READY
Note that it should be newline terminated. A er that, the program may receive mul ple lines
(iden cal format required as the le’s lines) represen ng the lo ery’s picks and it should be able to
report 4 space separated numbers in the standard output as fast as possible (line should be newline
terminated). The four numbers shall mean the number of winners with 2, 3, 4 and 5 matches
respec vely.
Expecta ons
● Write an op mized code that can report the results. The faster the be er.
● Document the asympto c run me and space complexity of your solu on
● Use code comments (enough to make it easy to understand)
tt
ti
ti
ft
ti
ti
ti
ti
ti
fi
fi
ti
ti
ti
fi
ti
tt
fi
ti
fi
tt
ft
ft
ft
ti
tt
ti
fi
tt
tt
ti
fi
ti
tt
ti
● Document your ideas how you could further improve the calcula on speed, if any
● Submit your code by email or share it privately (do not share it in public space like
github), including instruc ons on how to build and run.
ti
ti