This is the third question, the other 2 is probably an easy question of some sorts. I cant seem to think of a pattern regarding this question. Was only able to do brute force.