코딩 공부/Leetcode

[Python / Leetcode] 1980. Find Unique Binary String

일하는 공학도 2025. 2. 20. 10:27
728x90

난이도 : medium

 

n개의 '0'이나 '1'로 이루어진 요소 중 리스트 nums에는 없는 요소 하나를 return하는 문제

 

class Solution:
    def findDifferentBinaryString(self, nums: List[str]) -> str:
        return ''.join('1' if num[i] == '0' else '0' for i, num in enumerate(nums))

nums 내부 요소에서 0은 1로 바꿔버리고 return해버림!

 

Runtime : 0 ms

Memory : 17.68MB (88.03%)

728x90