- Today
- Total
목록스터디/코테 (223)
작심삼일
문제 링크: 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..
문제 링크: https://leetcode.com/problems/palindrome-partitioning/ 문제 Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. A palindrome string is a string that reads the same backward as forward. 조건 1
문제 링크: https://leetcode.com/problems/complement-of-base-10-integer/ 문제 The complement of an integer is the integer you get when you flip all the 0's to 1's and all the 1's to 0's in its binary representation. For example, The integer 5 is "101" in binary and its complement is "010" which is the integer 2. Given an integer n, return its complement. 조건 0 int: if n == 0: return 1 ans = 0 cur = 1 wh..
문제 링크: https://leetcode.com/problems/find-the-town-judge/ 문제 In a town, there are n people labeled from 1 to n. There is a rumor that one of these people is secretly the town judge. If the town judge exists, then: The town judge trusts nobody. Everybody (except for the town judge) trusts the town judge. There is exactly one person that satisfies properties 1 and 2. You are given an array trust w..
문제 링크: https://leetcode.com/problems/smallest-integer-divisible-by-k/ 문제 Given a positive integer k, you need to find the length of the smallest positive integer n such that n is divisible by k, and n only contains the digit 1. Return the length of n. If there is no such n, return -1. Note: n may not fit in a 64-bit signed integer. 조건 1