Just came back from my grade 11 comp sci competition. Came 6th and going to finals now. I solved the first 3 but was unable to solve this 4th one. Hardcoded it and got it partially correct but it really was bad. Can someone explain the steps you need to take to solve this? and if someone can solve this that would be nice too.