less than 1 minute read

Given a list of lowercase alphabet strings words, return the length of the longest contiguous sublist where all words share the same first letter.

Constraints

  • 0 ≤ n ≤ 100,000 where n is the length of words

https://binarysearch.com/problems/Longest-Alliteration

Examples

Example 1

Input

  • words = ['she', 'sells', 'seashells', 'he', 'sells', 'clams']

Output

  • answer = 3

Explanation

["she", "sells", "seashells"] all share the first letter s.

Solution

Leave a comment