Need help with code for SUBPRNJL-March Challenge

Can someone help me with this code, i am unable to figure out what type of test cases i am missing or if the logic is incorrect somehow,
Thanks in advance

Read this solution. The approaches are similar even if the languages are different. You should be able to figure out your error.

Thanks for the help, i understood my mistake.