https://ide.geeksforgeeks.org/3vjF4Ke9Gw---2 out of 9 test cases are not passing and also output for sample input is correct. What i m doing wrong, what are the errors in the code
String Window problem
https://ide.codingblocks.com/s/300487 corrected code.
Changes:
- Use nextLine instead of next for str2. (This was causing the error)
Some more good things to keep in mind:
- Use new int[256] to count chars instead of 128.
- Use:
if (res.length() == 0 || minLen > right - left + 1) {
I added the condition res.length() == 0