Partition the numbers January Challenge 2018

Hello friends , I am working on this problem and I am unable to pass all test cases ,here is my submission , I don’t know what I am missing .

It would be great help if anyone could help . Thanks in advance :slight_smile:

I checked your solution and it will give wrong output for case 2 8 and 2 11 and maybe many other.
your solution is in python so don’t getting much of it.
i have correct java solution link you can check it.In any part if you struck you can ask me here and i will try to clear doubt.