⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 18m 42s17 days 22 hours 18 minutes 42 seconds.
⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 18m 42s17 days 22 hours 18 minutes 42 seconds.

Sign in to watch this lesson
Algorithms - Strings · 4:07
Counting characters with a frequency array cnt[26]: two words are anagrams exactly when their count arrays are equal, a sliding window finds every anagram of a pattern in O(n + m) by updating two counters per step, and letters can be rearranged into a palindrome when at most one count is odd. Then palindromes from the outside in (two pointers, and a near miss that must try both deletions) and from the inside out (expanding around odd and even centres on abababc and cbaabd, after cp-algorithms.com), and the quadratic cost of expanding every centre of aaa...a, measured, which Manacher's algorithm later removes.