Smart keypad doubt run time error

I know my code has very high complexity but i cant think of a better solution…pls help

hey @Aayush_25, best solution to for this problem in limited time is Dynamic Programming. Try to implement that.

Ok I havent been taught that yet…Thanks

hey @Aayush_25 , if your query is resolved. Please mark this doubt as resolved and rate me on the basis of your experience.
rating option will appear when to mark this doubt as resolved