Longest Duplicate Substring | Day 19 | [June LeetCoding Challenge] [Leetcode #1044] [2020]

preview_player
Показать описание
The day 19 problem in June Leetcoding Challenge. ( Longest Duplicate Substring ).
Check out our other popular playlists:

Longest Duplicate SubString (0:14)
Applying Binary Search (1:07)
How to apply Rabin-Karp? (2:09)
Improvement in Rabin-Karp (3:09)

Problem statement:
Given a string S, consider all duplicated substrings: (contiguous) substrings of S that occur 2 or more times. (The occurrences may overlap.)

Return any duplicated substring that has the longest possible length. (If S does not have a duplicated substring, the answer is "".)

Example 1:
Input: "banana"
Output: "ana"

Example 2:
Input: "abcd"
Output: ""

If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful.

#coding #leetcode #softwareengineering #algorithmsMadeEasy
Рекомендации по теме
Комментарии
Автор

I hope you all are enjoying the June leetcoding challenge!!! Don't forget to leave a comment!!! Please like the video to support us!!!
Struggling in a question??
Leave in a comment and we will make a video!!!🙂🙂🙂

AlgorithmsMadeEasy
Автор

Explaining a solution in less than 5 miniutes is the best thing. You deserve more applauds.

saiyashwanth
Автор

your code compares substrings by hashes only ("if(set.contains(h)) return i;") . there is no check if substrings themselves match. with really big strings hashes of different substrings may clash and there may be false positives. so the solution works mostly but not always.

NefigTut
welcome to shbcf.ru