itrator's blog

By itrator, history, 2 years ago, In English
  • Vote: I like it
  • +2
  • Vote: I do not like it

By itrator, history, 2 years ago, In English

Question : Given a String (Eg:aabbbbaa), for all the substrings find the difference between freq[c1] — freq[c2] where c1 is the maximum occurring character and c2 is the minimum occurring character of that substring and print the largest difference of all substring of the string.

if u didn't get the question the link is below : https://leetcode.com/problems/substring-with-largest-variance/

I saw many of the solutions but couldn't understand the main intuition of applying the kadane Algo.

any other approach or kadane approach ,can anyone explain !!!

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it