After a little more searching around, I found out that the algorithm challenges will not pass if you use a global variable. I changed the above solution to remove the recursion call and used a while loop instead.
After a little more searching around, I found out that the algorithm challenges will not pass if you use a global variable. I changed the above solution to remove the recursion call and used a while loop instead.