Uber SSE frontend ds-algo interview question

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2024-06-06Added By Anonymous
Source: Link

Company: Uber

Role: Senior Software Engineer

Interview Stage: Phone Screen


Original Post Content:


// Verify whether a long text is following the order rule defined in order string.

// For example the order string is "abcd", which means "a" can't appear at any position after "b", "c" and "d" in the text, "b" can't appear at any position after "c" and "d" in the text and "c" can't appear at any position after "d" in the text. if the text is "axubbxcxbxd", then the text didn't follow the rule, since "b" appears after "c" in substring "cxb".


Follow up was that , if string was big. and how to handle is there incoming stream of characters.


isValid(string pattern, string tomatch)


I tried to solve using dp , but was overkill and took long time to implement.

Comments