I implement it using recursive function, as shown below. I am pretty sure I implement it in the right order, However I seem to fail the test cases of my assingment, can someone