can you help me out with the logic for finding the substrings in the output?
Smart keypad advance
Check now-> have just added the substring function, it will find substring between 2 string and will print your required output.
can you explain the functionality of the variables K and J
and also dry run the inner for loop
They are checking if the ith string from searching in range of k to j is equal to our string ans or not.
K & j are nothing but a range of indexes which are storing substring by .substr(k,j) and then checking it if itβs equal to ans or not.
Attaching a link which you can refer to see how we can check substring of 2 strings
Link