Smart Keypad - Advanced -run-error

https://hack.codingblocks.com/contests/c/537/97
https://ide.codingblocks.com/s/40916

Sample test case is working but shows run-error while submitting.

1 Like

Your code will only work for strings having length 2
Try with 341, your code will get runerror
So basically , just make a recursive function which will generate all the strings formed by the input string . And store them in a map/ array.
Then after recursion, iterate on this map/array and check for each item(string) of this map/array which is present in the SearchIn array , if it’s present the print it otherwise continue with this iteration
Hope , it helps

1 Like