Facebook, On site, String Rewriting (I think it's not on leetcode!) (April 2021)

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2021-04-06Added By Anonymous
Source: Link

Company: Meta (Facebook)
Role: e4, e5
Interview Stage: Onsite
Location: unknown
Year: 2021

Original Post Content:

This was a question on my Facebook Interview:
We have two rules to replace characters in a string:
A -> 'aBabAb'
B -> 'bAbaBa'
Assume we start with S0 = A and follow these two rules to build next strings. For example the next two strings would be:
S1 = aBabAb
S2 = abAbaBaabaBabAbb
....
Write a function to return mth character in Sn.

Comments