- Today
- Total
목록분류 전체보기 (387)
작심삼일
문제 링크: https://leetcode.com/problems/koko-eating-bananas/ 문제 Koko loves to eat bananas. There are n piles of bananas, the ith pile has piles[i] bananas. The guards have gone and will come back in h hours. Koko can decide her bananas-per-hour eating speed of k. Each hour, she chooses some pile of bananas and eats k bananas from that pile. If the pile has less than k bananas, she eats all of them ..
문제 링크: https://leetcode.com/problems/linked-list-cycle-ii/ 문제 Given the head of a linked list, return the node where the cycle begins. If there is no cycle, return null. There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Internally, pos is used to denote the index of the node that tail's next pointer is connec..
문제 링크: https://www.acmicpc.net/problem/2839 문제 상근이는 요즘 설탕공장에서 설탕을 배달하고 있다. 상근이는 지금 사탕가게에 설탕을 정확하게 N킬로그램을 배달해야 한다. 설탕공장에서 만드는 설탕은 봉지에 담겨져 있다. 봉지는 3킬로그램 봉지와 5킬로그램 봉지가 있다. 상근이는 귀찮기 때문에, 최대한 적은 봉지를 들고 가려고 한다. 예를 들어, 18킬로그램 설탕을 배달해야 할 때, 3킬로그램 봉지 6개를 가져가도 되지만, 5킬로그램 3개와 3킬로그램 1개를 배달하면, 더 적은 개수의 봉지를 배달할 수 있다. 상근이가 설탕을 정확하게 N킬로그램 배달해야 할 때, 봉지 몇 개를 가져가면 되는지 그 수를 구하는 프로그램을 작성하시오. 입력 첫째 줄에 N이 주어진다. (3 ≤ N..
문제 링크: https://leetcode.com/problems/word-pattern/ 문제 Given a pattern and a string s, find if s follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in s. 조건 1

문제 링크: https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/ 문제 There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array points where points[i] = [$x_{start}, x_{end}$] denotes a balloon whose horizontal diameter stretches between $x_{start}$ and $x_{end}$. You do not know the exact y-coordinates..
문제 링크: https://leetcode.com/problems/insert-into-a-binary-search-tree/ 문제 You are given the root node of a binary search tree (BST) and a value to insert into the tree. Return the root node of the BST after the insertion. It is guaranteed that the new value does not exist in the original BST. Notice that there may exist multiple valid ways for the insertion, as long as the tree remains a BST aft..
문제 링크: https://leetcode.com/problems/add-binary/ 문제 Given two binary strings a and b, return their sum as a binary string. 조건 1 Nb: Rb += '0' * (Na-Nb) elif Nb > Na: Ra += '0' * (Nb-Na) t = 0 for ta, tb in zip(Ra, Rb): s = t + int(ta) + int(tb) if s == 0: ans += '0' t = 0 elif s == 1: ans += '1' t = 0 elif s == 2: ans += '0' t = 1 elif s == 3: ans += '1' t = 1 ans += str(t) if ans[-1] == '0': re..
문제 링크: https://leetcode.com/problems/car-pooling/ 문제 There is a car with capacity empty seats. The vehicle only drives east (i.e., it cannot turn around and drive west). You are given the integer capacity and an array trips where trip[i] = [$numPassengers^i, from^i, to^i$] indicates that the $i^{th}$ trip has $numPassengers^i$ passengers and the locations to pick them up and drop them off are $f..