LEETCODE 49 (JAVASCRIPT) | GROUP ANAGRAMS | CODING INTERVIEW PREP

Поделиться
HTML-код
  • Опубликовано: 3 фев 2025

Комментарии • 10

  • @aamiramin6112
    @aamiramin6112 Год назад

    Very informative.
    Thanks for sharing

  • @racerX4787
    @racerX4787 3 года назад

    Excellent, well done Andy

  • @rram6875
    @rram6875 2 года назад +2

    Hey Andy, excellent tutorial. I have one question however. Is it okay to use the js built in sort method in an interview or am I expected to implement a sort algo?

  • @emday4prez
    @emday4prez 3 года назад

    nice one andy, thanks again

  • @venkat7667
    @venkat7667 2 года назад

    nice explanation

  • @LazyShady
    @LazyShady 2 года назад +3

    Damn it I spent way to long on this problem

  • @nipunjain1142
    @nipunjain1142 2 года назад

    Please do more regular videos

  • @Eeezus1914
    @Eeezus1914 2 года назад +1

    could you explain how the space is O(n) when you're sorting an array with O(n) where n is the length of the input and you're doing n log n work to sort it? The function is O(n). Perhaps you made a mistake and reversed them when speaking and typing? Runtime should be O(n) and Space should be O(n x n logn)

    • @gianlazaro
      @gianlazaro 2 года назад

      Space complexity is O(n) because the hash grows linearly depending on how many words are there in the input array. Time complexity is O(n*nlogn) because any sorting algorithm (except radix sort) would require comparisons between every letter and on top of that, there was another for loop to run through the sorted array.