Hi, do you have an attempt/code that you can share with us so we can help you find mistakes in it?
If not, have you devised an algorithm or pseudo code for tackling the problem?
If not, have you devised an algorithm or pseudo code for tackling the problem?