educative.io

Provided solution is not optimal

For the “Words Concatenation (hard)” problem (Problem Challenge 4 of the Sliding Window pattern), the solution provided in the course is not the optimal solution, at least in terms of time complexity.
Could the course be updated to include the optimal solution, or at the very least indicate that the solution provided is not optimal? This would go a long way into helping users trust the course and its content. Thanks!

A faster solution can be found, for example, in Leetcode (Problem 30. Substring with Concatenation of All Words). The faster solution would be Approach 2 in the solution tab for the problem.


Course: Grokking the Coding Interview: Patterns for Coding Questions - Learn Interactively
Lesson: Solution Review: Problem Challenge 4 - Grokking the Coding Interview: Patterns for Coding Questions

3 Likes

Hi, @wtxb Firstly thank you for the suggestion. Secondly, there exist many approaches for solving any problem. Our given approach is just for implementation purposes. If you want to use any other approach which seems easier to you, then you can use it.

Hope it will help, Thank you :blush: