bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
MediumArrays & HashingLC 1156

Swap For Longest Repeated Character Substring

You are given a string text. You can swap two of the characters in the text. Return the length of the longest substring with repeated characters.

Asked at 2 companies
MicrosoftNutanix
Hints
  • 1.Think about which data structure fits best
  • 2.Consider the time complexity of your approach
  • 3.Look for patterns in the constraints
LeetCode