That's a great question. First, you need to make sure the problem can actually be solved using the sliding window technique. Sometimes the solution involves dynamic programming or other approaches and is not solvable with sliding window. Once you know the problem is solvable using the sliding window technique, you need to figure out an update procedure where you move from the previous segment of elements to the new one. This usually depends on the problem but in most cases you can increment one side 1 by 1 and adjust the other side with a while loop. That will make sure you don't miss any possible solutions.
Clear and concise. Thank you for teaching me these techniques.
I really like your videos keep up the good work♥
Nice explanation 👌
Nice explanation. But now I actually wonder if there are cases where the second, dynamic routine misses possible solutions.
That's a great question. First, you need to make sure the problem can actually be solved using the sliding window technique. Sometimes the solution involves dynamic programming or other approaches and is not solvable with sliding window.
Once you know the problem is solvable using the sliding window technique, you need to figure out an update procedure where you move from the previous segment of elements to the new one. This usually depends on the problem but in most cases you can increment one side 1 by 1 and adjust the other side with a while loop. That will make sure you don't miss any possible solutions.
Thank you so much
great exokanatio
🤩🤩