목록easy (9)
취미가 좋다
https://leetcode.com/problems/invert-binary-tree/ Invert Binary Tree - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Solution from collections import deque class Solution: def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: if not root: return root d = deque() d..
https://leetcode.com/problems/duplicate-emails/ Duplicate Emails - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Solution SELECT Email FROM Person GROUP BY Email HAVING COUNT(Email) > 1 Email이 같은 항목의 개수를 보고 중복되는 데이터를 반환한다. GROUP BY ... HAVING 을 이용하여 중복되는 데이터를 묶는다. COUNT 를 이용하여 중복..
https://leetcode.com/problems/employees-earning-more-than-their-managers/ Employees Earning More Than Their Managers - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Solution SELECT A.Name as Employee FROM Employee A INNER JOIN Employee B ON A.ManagerID = B.ID WHERE A.Salary > B.S..
https://leetcode.com/problems/second-highest-salary/ Second Highest Salary - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Solution SELECT Max(Salary) SecondHighestSalary FROM Employee WHERE Salary < (SELECT Max(Salary) FROM Employee) 서브 쿼리에 미리 제일 큰 수를 구해놓고, 그 다음 큰 수를 찾는다. SELECT..
https://leetcode.com/problems/combine-two-tables/ Combine Two Tables - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com SELECT P.FirstName, P.LastName, A.City, A.State FROM Person P LEFT JOIN ADDRESS A ON P.PersonID = A.PersonID SELECT 할 때, P 혹은 A 를 입력하지 않고 그대로 FirstName, LastName, ..
https://leetcode.com/problems/majority-element/ Majority Element - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority ..