[Medium] Sherlock and Anagrams (Hackerrank, javascript, strings, dictionaries)

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

Resulted solution is sub-optimal and fails to timeout.
Please, comment, if you're interested in optimal solution for this one.
Рекомендации по теме
Комментарии
Автор

Hi thank you for sharing the solution, would like to check where to find the optimal soln

thedevguild
Автор

I made an mistake while explain complexity: for space complexity it will be (n^3) because we have an array with (n-1) sub arrays (lengths), each array has (n-currentLength) elements, and evey element is up to exactly same length. But in meaning of big O it is still O(n^2) since we're dropping constants. Time complexity will be also O(n^2) by same reasons.

AlexZAV
visit shbcf.ru