LeetCode solutions

2999. Check if Strings Can be Made Equal With Operations I

My accepted Python solution to LeetCode problem 2999, Check if Strings Can be Made Equal With Operations I, running in 0ms.

  • Difficulty: Easy
  • Python
  • Runtime 0ms
  • Memory 17.3MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 0ms, memory 17.3MB, accepted 2026-01-02.

python
class Solution:
    def canBeEqual(self, s1: str, s2: str) -> bool:
        return sorted(s1[0::2]) == sorted(s2[0::2]) and sorted(s1[1::2]) == sorted(s2[1::2])

Source