Added a brute force implementation for comparison
Added a description of the solution in the javadoc comments