​brute force

​brute force

The Algorithm

?