Google | Phone Screen | Twitch Words
Anonymous User
3235

You are given a word like hellloooo print all the repeating character index and the number of time it is has been repeated: https://leetcode.com/problems/positions-of-large-groups

Example 1:

Input: "hellloooo"
Output: [[2, 3], [5, 4]]
Explanation: hellloooo has l and o as repeating characters so return index of l which is at 2
and the number of times it has been repeated is 3. Same goes for O.

Example 2:

Input: "leetcodeee"
Output: [[1, 2], [7, 3]]

Follow-up:
What if you need to print the repeated character as well?

Example 1:

Input: "hellloooo"
Output : [['l', 3], ['o', 4]]

Example 2:

Input: "leetcodeee"
Output: [['e', 5]]
public List<List<Integer, Integer>> findRepeated(String s) {
}
Comments (7)