November 03 2021, 14:35

I came up with a task that trips up 90% of junior programmers and highlights candidates for mid-level positions. It consists of just three words: shuffle the array. Surprisingly, but it works very reliably.

The next level – grouping objects by field A with summation of field B to create a hashmap distinct(A) -> sum(B). All juniors and even mids, who claim they know Java streams, usually get stuck here, and most likely fail.

You can also ask them to find the longest string from an array of strings in a single lambda expression.

The next level – compare two long lists of complex objects to show what overlaps and what differs and in which direction. This is a very common business task (at least in my integration). Of course, under conditions of limited resources.

From the same category – sort (effectively normalize) JSONs that contain nested arrays of complex structures.

The questions programmers ask about these tasks and how they solve them are very telling.

Leave a comment