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
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 0ms, memory 17.3MB, accepted 2026-01-02.
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])