2546. Apply Bitwise Operations to Make Strings Equal
Read the full problem statement on LeetCode.
Difficulty: medium Acceptance: 42% Topics: String, Bit Manipulation
View full problem on LeetCode Reading material
Reference solution (spoiler · python)
# Time: O(n)
# Space: O(1)
# constructive algorithms
class Solution(object):
def makeStringsEqual(self, s, target):
"""
:type s: str
:type target: str
:rtype: bool
"""
return ('1' in s) == ('1' in target)
Solution from kamyu104/LeetCode-Solutions · MIT
Similar questions