Google Interview Question
Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2024-11-04Added By Anonymous
Source: Link
🧭 Experience: unknown
✅ Outcome: unknown
💰 Compensation: unknown
📍 Location: unknown
🏢 Company: Google
🎓 Education: unknown
🎁 Benefits: unknown
📅 Offer Date: unknown
Recently I came across a google interview question. The question is as follows: You are given two strings,
✅ Outcome: unknown
💰 Compensation: unknown
📍 Location: unknown
🏢 Company: Google
🎓 Education: unknown
🎁 Benefits: unknown
📅 Offer Date: unknown
Recently I came across a google interview question. The question is as follows: You are given two strings,
P and Q consisting of characters 'a' and 'b'.
At any given point you can perform two kind of operations on the string P:
1. You either append character a to P.
2. You append character b to P and then you reverse P.
You can perform any of these operations any number of times.
You have to tell me whether it is possible for P to be equal to Q, after performing such operations?
An example:
1. P = a, Q = baa. this will return true,
2. P = b, Q = ab, this will return false
Can someone tell me, how I can approach this question or such questions? Because I am having difficulty in grasping a way on how to proceed?