Skip to content

Practice Check if Strings Can be Made Equal With Operations II

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

Medium#2840
LeetCode Problem

Check if Strings Can be Made Equal With Operations II

Problem Statement

Given equal-length lowercase strings s1 and s2, you may repeatedly swap two different positions of the same parity in either string. Return whether these operations can make the two strings equal.

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

Examples

# Example 1

Input
s1 = "abcdba", s2 = "cabdab"
Output
true

# Example 2

Input
s1 = "abe", s2 = "bea"
Output
false

Constraints

n == s1.length == s2.length
1 <= n <= 10^5
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 II.

Review your practice with PhantomCodeAI

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