Check if Strings Can be Made Equal With Operations I Problem
Check if Strings Can be Made Equal With Operations I Problem — ExecCode Easy DSA Practice
Solve the Check if Strings Can be Made Equal With Operations I problem on ExecCode. Free online easy DSA practice in String. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given two strings s1 and s2, both of length 4, consisting of lowercase English letters. Your task is to compute the required answer and return true if you can make the strings s1 and s2 equal, and false otherwise. You can apply the following operation on any of the two strings any number of times: - Choose any two indices i and j such that j - i = 2, then swap the two characters at those indices in the string.
Examples
Input {"s1": "abcd", "s2": "cdab"}; Output True. Input {"s1": "abcd", "s2": "dacb"}; Output False
Constraints
s1.length == s2.length == 4 s1 and s2 consist only of lowercase English letters.
Practice Check if Strings Can be Made Equal With Operations I free on ExecCode. Browse DSA problems, topic map, and placement guides.