As reported: Walmart SDE intern college hiring, online test on HackerEarth (Mar 2024), coding question 1 (30 points): Make Two Strings Equal with Swaps — characters may be swapped within one string or between the two strings.
You are given two strings s1 and s2 of the same length. In one move you may swap any two characters: two positions of the same string, or one position of s1 with one position of s2. Moves are unlimited. Return true if the strings can be made equal.
Example 1
s1 = "abab", s2 = "baba" -> true
Example 2
s1 = "aab", s2 = "bcc" -> true (both can become "abc")
Example 3
s1 = "ab", s2 = "cd" -> false
Constraints: 1 ≤ |s1| = |s2| ≤ 10^5; lowercase English letters.
Code runner format: one JSON value per line: s1, then s2. Implement canMakeEqual(s1, s2); the harness prints true or false.