Google | Phone | Find Index of Extra Character
Anonymous User
2250

Position: L4

Given two strings, find the index of the extra character that only appears in one of the strings.

Example 1:

Input: s = "wxgyz", t = "wxyz"
Output: 2

Example 2:

Input: s = "bxbbb", t = "bbbb"
Output: 1

EDIT: Can this be solved in faster than linear time? Bc I know you can easily loop over it/use a hash map but that answer wasnt acceptable

Comments (19)