Https://ide.codingblocks.com/s/326326

can u please tell why my o/p is not coming?

Can you please share your idea?

i have shared my code

Yes, I see that, but I see a lot of faults there. So if you tell me what you want to do, I can tell why it is wrong or it won’t work.

i have taken a freq array for both strings and marked the freq of string 2 first. then i have taken the freq array of string and marked accordingly and checked if the req char of string 2 are completed in string1 or not and taken the cnt variable to do so. after that if the len of string 2 is met, then i try to reduce the size of my current string by shrinking it from left. as soon as i get the least possible string, i stop and take a note of its min len…this process cont untill we get the string of min len by the process of expansion and contraction.

Sorry my bad, actually the problem is with your input.

Using cin will not include spaces (’ ') in input, you will have to use something like getline().

https://ide.codingblocks.com/s/326963 in some test cases i’m getting run error. can u rectify it?

initialize wlen with 10001, not 10000.

its still not working

Still runtime error?

Please share the details of the testcases and corresponding verdicts, I’ll fast track your doubt then (because it has already been more than 8 days).

i dont have the details of the test cases

I meant the testcase numbers, that you are getting RTE at.

i got it correct now!

1 Like