Meta Coding Interview Question - Group Shifted Strings (LeetCode)

preview_player
Показать описание
Group Shifted Strings is a popular Facebook coding interview problem involving the use of a Hashmap data structure.

Check out my interview prep platform for learning the patterns!

🔗 Social 🔗

⭐️ Timestamps ⭐️
00:00 - Problem Overview
01:32 - Algorithm
04:19 - Code
09:35 - Time & Space Complexity
Рекомендации по теме
Комментарии
Автор

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

ritn
Автор

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

LeHoangTu
Автор

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

nanotechnologk
Автор

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.

CronusVelox
Автор

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.

MingoDynasty
Автор

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.

hamsalekhavenkatesh
welcome to shbcf.ru