Meta Coding Interview Question - Group Shifted Strings (LeetCode)

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ก.ย. 2024

ความคิดเห็น • 9

  • @CronusVelox
    @CronusVelox ปีที่แล้ว

    Good video! You don't need to add 1 when calculating the ints for prev Val and curr Val. Say if you have prev val as "b" and curr Val as "c" then the difference of these two indices (assuming 0 indexed) is 2 - 1 = 1. Now if we shifted them both by one it should be (2 + 1) - (1 + 1) = 1 (the same thing!). 26 is important though because that's how many characters in the alphabet we have.

  • @007ritn
    @007ritn 2 ปีที่แล้ว

    You have this rare ability of explaining things in the simplest form possible, good job ! And thanks a lot for this video.

  • @MingoDynasty
    @MingoDynasty 2 ปีที่แล้ว

    Instead of building an int and using a delimiter, just build the shifted string. i.e. if the string is "CDE", then just shift the entire string so that the first character begins with "A". Then you don't need a delimiter.

  • @hamsalekhavenkatesh3440
    @hamsalekhavenkatesh3440 2 ปีที่แล้ว

    im wondering if we can convert this to a graph problem where vertices are characters in a word and edge would be difference between the chars, and then run a BFS/DFS ? Time would be more or less same.

    • @AlgosWithMichael
      @AlgosWithMichael  2 ปีที่แล้ว

      I think you could, but it would require a more tedious preprocessing step

  • @nanotechnolog2k08
    @nanotechnolog2k08 2 ปีที่แล้ว

    Love your channel, appreciate your explanations, very easy to understand. Thank you!

  • @LeHoangTu
    @LeHoangTu 2 ปีที่แล้ว

    Love it. Great to see you keep posting new video!