Greek mathematician Pythagoras gave famous theorem to relate sides of right angel triangle:

Ask candidate to write a function in any higher level language to discover all Pythagorean triplets a, b and c where a,b,c > 0 and less than given number N, such that:

a^2 + b^2 = c^2

For example, (3, 4, 5) is a Pythagorean triplet.

Once candidate writes a brut-force solution, ask to optimize the solution.