전체 글30 [LeetCode][MySQL] Customers Who Bought All Products https://leetcode.com/problems/customers-who-bought-all-products/ Customers Who Bought All Products - LeetCode Can you solve this real interview question? Customers Who Bought All Products - Table: Customer +-------------+---------+ | Column Name | Type | +-------------+---------+ | customer_id | int | | product_key | int | +-------------+---------+ This table may leetcode.com select customer_id .. 2024. 1. 5. [LeetCode][MySQL] Tree Node https://leetcode.com/problems/tree-node Tree Node - LeetCode Can you solve this real interview question? Tree Node - Table: Tree +-------------+------+ | Column Name | Type | +-------------+------+ | id | int | | p_id | int | +-------------+------+ id is the column with unique values for this table. Each row of this leetcode.com select distinct a.id, ( case when a.p_id is null then 'Root' when b.. 2024. 1. 3. [LeetCode][MySQL] Friend Requests II: Who Has the Most Friends https://leetcode.com/problems/friend-requests-ii-who-has-the-most-friends/ Friend Requests II: Who Has the Most Friends - LeetCode Can you solve this real interview question? Friend Requests II: Who Has the Most Friends - Table: RequestAccepted +----------------+---------+ | Column Name | Type | +----------------+---------+ | requester_id | int | | accepter_id | int | | accept_date | leetcode.co.. 2024. 1. 3. [프로그래머스][파이썬] 2 x n 타일링 https://school.programmers.co.kr/learn/courses/30/lessons/12900 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(n): arr = [1,2] for _ in range(3, n+1): arr.append((arr[-1] + arr[-2]) % 1000000007) return arr[n-1] 규칙만 찾으면 생각보다 쉽게 풀 수 있는 문제다. 경우의 수가 [1, 2, 3, 5, 8 ...] 형태로 증가하므로 arr[-1], arr[-2]을 더한 값을 구하면 된다. 다만 효율성 테스트를 .. 2023. 12. 30. [프로그래머스][파이썬] 숫자 변환하기 https://school.programmers.co.kr/learn/courses/30/lessons/154538 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(x, y, n): answer = 0 arr = [x] while True: s = set() flag = 0 for num in arr: if num == y: return answer if num < y: flag = 1 s.add(num+n) s.add(num*2) s.add(num*3) #x를 2로 만들 수 없는 경우 if flag == 0: return -1 an.. 2023. 12. 29. [LeetCode][MySQL] Rearrange Products Table https://leetcode.com/problems/rearrange-products-table Rearrange Products Table - LeetCode Can you solve this real interview question? Rearrange Products Table - Table: Products +-------------+---------+ | Column Name | Type | +-------------+---------+ | product_id | int | | store1 | int | | store2 | int | | store3 | int | +-------------+------- leetcode.com select product_id, 'store1' as store,.. 2023. 12. 29. 이전 1 2 3 4 5 다음