Longest common substring problem suffix array part 2

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

Data structures repository:

Kattis problem:

My website:

Рекомендации по теме
Комментарии
Автор

These are clear and on point. Loved them. Thanks for making these.

shawankush
Автор

Great video. So i was trying to implement it and use it in question on Kattis. But not clear what sentinels i can use when n can be up to 100. As i would always have to start from 35 and end at 97.
I thought i could maybe start using doubles after that like ## but i feel this will add lot of complexity like maintaining index range for sentinels instead of just index. Any simpler approaches which can tackle this easily.

niteshgarg
Автор

Hey William! Thank you for all your videos. Your content is awesome.
Here I am having trouble in getting the intuition behind solving the LCS problem by this method? Can you tell more on why this works better?
How's is the time complexity linear( O(n1+n2+...nm) from prev video ) ?
Sorting will take extra O(nlogn) where n is the sum of lengths + sentinels.

rohitbohra
Автор

Great Video. I love it. I've got one doubt. At 2:37 when window has two string
0 -> "BC#BCDC$BCDE%CDED&" and 2 -> "BCDC$BCDE%CDED&" if we apply range minimum query on it, we'll get answer 0 as minimum of (0, 2) = 0. So what should we take care of when we're implementing code?

hirenchauhan
Автор

What a wild problem. You need a suffix array, LCP array, a hashmap, and finally apply sliding window minimum.
Good luck to whoever gets asked this in an interview for k > 2 (else you would just use DP).

Squirrelschaser
Автор

Great video! Could you make a video on how to create suffix and LCP array in O(n)?

doomlord
Автор

Do we have to take a max LCP or min LCP ? At 3:17 you have taken the largest LCP and before that you took lowest LCP, window {2, 3} why did you not take 2 that time ?

rushilp
Автор

What is the benefit of concatenating those 4 strings?

I thought about it and don't get it.

Is it just to make it easier to understand? Otherwise you probably could have created the suffix array from all 4 strings anyway right?

Sicaine
Автор

Sir, do we have to take min LCP or max LCP?

sasanktadepalli
Автор

Hi, Your videos are great. Can you please add a video explaining "Find the longest palindromic substring of a string using suffix array. e.g. abacdxzdcaba has aba as the longest palindrome, "

subhadippanja
Автор

Initially when u compared the two strings with LCP 0 & 2, Then why did u update the LCS Length.

Coz as far I understood, you have to ignore any windows with 0 in them right?

Bruh-jwze
Автор

how do you figure out what "color" it is?

talkingmango