Day 13 GFG (Longest repeating and non-overlapping substring)
Channel: Dawn Of Coders
Date: 07/03/2024

Welcome to our tutorial on solving problems for Geek for Geeks Day! 🎉 In this video, we tackle the challenge of finding the longest repeating non-overlapping substring in a given string. We'll explore an efficient algorithm to identify two identical substrings of maximum length that do not overlap. Join us as we dive into problem-solving mode and unravel the mysteries of this intriguing problem!

🔗 Connect with us:
Twitter: twitter.com/DawnOfCoders
Instagram: /dawnofcoders
GitHub: github.com/AggarwalNeelesh/GeekForGeeks-POTD

Problem Statement:
Given a string s of length n, find the longest repeating non-overlapping substring in it. In other words, find two identical substrings of maximum length that do not overlap. Return the longest non-overlapping substring. Return "-1" if no such string exists. Note: Multiple answers are possible, but you have to return the substring whose first occurrence is earlier.

For Example:
In the string "abhihiab", both "ab" and "hi" are possible answers. However, we return "ab" because its first occurrence appears before the first occurrence of "hi".