This problem is from my intermediate problem solving certificate on Hackerrank (it is already overand I failed horribly). I only managed to pass 3 out of 15 testcases and I am not sure where I went wrong, can s