Skip to content

Practice Check if Strings Can be Made Equal With Operations I

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2839
LeetCode Problem

Check if Strings Can be Made Equal With Operations I

Problem Statement

Given two lowercase strings s1 and s2 of length four, you may repeatedly swap two positions in either string only when their indices differ by exactly two. Return whether the strings can be made equal.

Source: Check if Strings Can be Made Equal With Operations I on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
s1 = "abcd", s2 = "cdab"
Output
true

# Example 2

Input
s1 = "abcd", s2 = "dacb"
Output
false

Constraints

s1.length == s2.length == 4
s1 and s2 consist only of lowercase English letters.

Related LeetCode Problems

Practice more problems similar to Check if Strings Can be Made Equal With Operations I.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.