[LeetCode] 101. Symmetric Tree
·
Problem Solving/LeetCode
출처 : https://leetcode.com/problems/symmetric-tree/ Symmetric Tree - LeetCode Can you solve this real interview question? Symmetric Tree - Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center). Example 1: [https://assets.leetcode.com/uploads/2021/02/19/symtree1.jpg] Input: roo leetcode.com 1. 문제 설명 root Node를 기준으로 left Node와 right Node가 서로 대칭(..
[LeetCode] 1823. Find the Winner of the Circular Game
·
Problem Solving/LeetCode
출처 : https://leetcode.com/problems/find-the-winner-of-the-circular-game/description/ Find the Winner of the Circular Game - LeetCode Can you solve this real interview question? Find the Winner of the Circular Game - There are n friends that are playing a game. The friends are sitting in a circle and are numbered from 1 to n in clockwise order. More formally, moving clockwise from the it leetcode..
[LeetCode] 835.Image Overlap
·
Problem Solving/LeetCode
출처 : https://leetcode.com/problems/image-overlap/ Image Overlap - LeetCode Image Overlap - You are given two images, img1 and img2, represented as binary, square matrices of size n x n. A binary matrix has only 0s and 1s as values. We translate one image however we choose by sliding all the 1 bits left, right, up, and/or down any leetcode.com 1. 문제 설명 주어진 img1을 상, 하, 좌, 우로 움직여서 img2를 만들 때 가장 많이 ..
[LeetCode] 433. Minimum Genetic Mutation
·
Problem Solving/LeetCode
출처 : https://leetcode.com/problems/minimum-genetic-mutation/ Minimum Genetic Mutation - LeetCode Minimum Genetic Mutation - A gene string can be represented by an 8-character long string, with choices from 'A', 'C', 'G', and 'T'. Suppose we need to investigate a mutation from a gene string startGene to a gene string endGene where one mutation is defin leetcode.com 1. 문제 설명 유전자 문자열은 A, C, G, T로 이..
[LeetCode] 290. Word Pattern
·
Problem Solving/LeetCode
출처 : https://leetcode.com/problems/word-pattern/ bool: s = list(s.split()) # 문자열 s를 list형태로 바꾼다. dic=defaultdict(str) # key값이 str형태인 딕셔너리를 만든다. if len(pattern) != len(s) : # 중복을 제거하지 않은 상태의 각 문자의 길이가 다르다면 return False # False if len(set(pattern)) != len(set(s)) : # 중복을 제거한 후의 각 문자의 길이가 다르다면 return False # False for i in range(len(pattern)) : if pattern[i] in dic and s[i] != dic[pattern[i]] : # d..