Hiring process8 levels
  1. 1 IQ Test
  2. 2 Additional Online Test (If Required)
  3. 3 Office Interview with Hiring Manager
  4. 4 Unpaid Test Task (Motivation Check)
  5. 5 Paid Test Task and Follow-Up Interview
  6. 6 Iterative Paid Test Tasks
  7. 7 Office Verification
  8. 8 Final Interview with the Founder

Problems > Every Palindrome, Counted > Editorial

Every Palindrome, Counted — Solution & Editorial

Back to the Problem

Manacher's algorithm computes the palindrome radius at every odd and even center in O(n); the total count is the sum of all radii (each radius r contributes r palindromes centered there).

Complexity: O(|S|)

Watch out: Count reaches ~1012 for 'aaaa...'; 64-bit.