Answer: AMEYO Hiring Challenge | Online Assessment Question | Off-Campus (2024)
Answer · Posted Jun 2026
Approach Instead of creating large concatenated strings, compare characters directly using two pointers. Maintain: Current word index in both arrays Current character index inside each word Compare characters one by one. If any mismatch occurs, return false. If both arrays finish simultaneously, return true. Strategy Initialize pointers for both arrays. Compare current characters. Move character pointers forward. When a word ends, move to the next word. Continue until one array finishes. Return true only if both finish together. Java Code ...
The full answer & interview discussion are available to premium members.
Log in Create a free account