RAPIDO Hiring | Find Maximum Number of String Pairs | On-Campus OA (2024)
Question · Posted Jun 2026
Problem Statement You are given a 0-indexed array words where each element is a string of length 2. Two strings form a pair if one string is the reverse of the other. Return the maximum number of pairs that can be formed. Each string can be used in at most one pair. Example Input words = ["cd","ac","dc","ca","zz"] Output 2 Explanation Possible pairs: "cd" ↔ "dc" "ac" ↔ "ca" The string "zz" cannot form a pair. Therefore, the maximum number of ...
The full answer & interview discussion are available to premium members.
Log in Create a free account