Problem : https://leetcode.com/problems/permutation-in-string/
My solution : https://ide.codingblocks.com/s/288131
Please explain why I am not getting the desired output ?
Problem : https://leetcode.com/problems/permutation-in-string/
My solution : https://ide.codingblocks.com/s/288131
Please explain why I am not getting the desired output ?
hi @vaishnavtannu, at line 33 , you should put an if statement
i.e if(isS1PermutationOfSubstr(s1, s2.substr(i,len1)))
if you don’t then your function will return true for every case ,try to think why
also your method for taking substring is wrong what you were doing is taking entire string from ith index afterwards but you need to check for the substring of s2 having same length as s1
corrected code :-
also , there is a lot of scope of improvement both in terms of space and time complexity ,try to think how
In case of any doubt feel free to ask
Mark your doubt as RESOLVED if you got the answer
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.