Answer: RAPIDO Hiring | Find Maximum Number of String Pairs | On-Campus OA (2024)
Answer · Posted Jun 2026
Approach Use a HashSet to keep track of strings seen so far. For each word: Generate its reverse. If the reverse already exists in the set: A valid pair is found. Increment pair count. Remove the reverse from the set. Otherwise, add the current word to the set. This ensures each string is used only once. Strategy Create an empty HashSet. Traverse all words. For each word: Compute its reverse. If reverse exists in the set: Count one pair. Remove ...
The full answer & interview discussion are available to premium members.
Log in Create a free account