Leetcode 1316: Distinct Echo Substrings

preview_player
Показать описание


📚 MY ALGORITHMS BOOKS RECOMMENDATIONS:

📚 MY SYSTEM DESIGN BOOKS RECOMMENDATIONS:

🎥 MY FAVOURITE GEAR
Комментарии
Автор

Great explanation. However, the time complexity isn't O(n^2) but O(n^3). This is because constructing and comparing the substring in the if statement takes O(n) time in the worst case. You can still get an O(n^2) solution using rolling hash :)

mohammedshoaib
welcome to shbcf.ru