문제 보기
For two strings s and t, we say "t divides s" if and only if s = t + ... + t (i.e., t is concatenated with itself one or more times).Given two strings
There are n kids with candies. You are given an integer array candies, where each candiesi represents the number of candies the ith kid has, and an in
605. Can Place Flowers Solved Easy Topics Companies You have a long flowerbed in which some of the plots are planted, and some are not. However, flowe
Given a string s, reverse only all the vowels in the string and return it.The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lowe
Given an input string ss will be separated by at least one space.Return a string of the words in reverse order concatenated by a single space.s may co
Given an integer array nums, return an array answer such that answeri is equal to the product of all the elements of nums except numsi.The product of
Given an integer array nums, return true if there exists a triple of indices (i, j, k) such that i < j < k and numsi < numsj < numsk. If n
Given an array of characters chars, compress it using the following algorithm:Begin with an empty string s. For each group of consecutive repeating ch
Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements.Note that you must do this in
392. Is Subsequence Description Given two strings s and t, return true if s is a subsequence of t, or false otherwise. A subsequence of a string is
You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, hei
You are given an integer array nums and an integer k.In one operation, you can pick two numbers from the array whose sum equals k and remove them from
643. Maximum Average Subarray I Description You are given an integer array nums consisting of n elements, and an integer k. Find a contiguous subarra
Given a string s and an integer k, return the maximum number of vowel letters in any substring of s with length k.Vowel letters in English are 'a', 'e
Given a binary array nums and an integer k, return the maximum number of consecutive 1's in the array if you can flip at most k 0's.이진 배열 nums와 정수 k가
Given a binary array nums, you should delete one element from it.Return the size of the longest non-empty subarray containing only 1's in the resultin
1732. Find the Highest Altitude Description There is a biker going on a road trip. The road trip consists of n + 1 points at different altitudes. The
Given an array of integers nums, calculate the pivot index of this array.The pivot index is the index where the sum of all the numbers strictly to the
Given two 0-indexed integer arrays nums1 and nums2, return a list answer of size 2 where:answer0 is a list of all distinct integers in nums1 which are
Given an array of integers arr, return true if the number of occurrences of each value in the array is unique or false otherwise.정수 배열 arr 주어지면 배열에 있는
Two strings are considered close if you can attain one from the other using the following operations:Operation 1: Swap any two existing characters.For
Given a 0-indexed n x n integer matrix grid, return the number of pairs (ri, cj) such that row ri and column cj are equal.A row and column pair is con
leetcode linkYou are given a string s, which contains stars \*.In one operation, you can:Choose a star in s.Remove the closest non-star character to i
leetcode linkWe are given an array asteroids of integers representing asteroids in a row.For each asteroid, the absolute value represents its size, an
leetcode link Description Given an encoded string, return its decoded string. The encoding rule is: , where the inside the square brackets is being
leetcode linkYou have a RecentCounter class which counts the number of recent requests within a certain time frame.Implement the RecentCounter class:R
leetcode linkIn the world of Dota2, there are two parties: the Radiant and the Dire.The Dota2 senate consists of senators coming from two parties. Now
leetcode linkYou are given the head of a linked list. Delete the middle node, and return the head of the modified linked list.The middle node of a lin
leetcode linkGiven the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return
leetcode linkGiven the head of a singly linked list, reverse the list, and return the reversed list.주어진 단일 연결 리스트의 head가 있을 때, 이 리스트를 뒤집고 뒤집힌 리스트를 반환합
In a linked list of size n, where n is even, the ith node (0-indexed) of the linked list is known as the twin of the (n-1-i)th node, if 0 <= i <
Given the root of a binary tree, return its maximum depth.A binary tree's maximum depth is the number of nodes along the longest path from the root no
Consider all the leaves of a binary tree, from left to right order, the values of those leaves form a leaf value sequence.For example, in the given tr
Given a binary tree root, a node X in the tree is named good if in the path from root to X there are no nodes with a value greater than X.Return the n
Given the root of a binary tree and an integer targetSum, return the number of paths where the sum of the values along the path equals targetSum.The p
leetcode link Description You are given the root of a binary tree. A ZigZag path for a binary tree is defined as follow: Choose any node in the bina
leetcode linkGiven a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to the definition of LCA on Wikipedia
leetcode linkGiven the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered fr
leetcode linkGiven the root of a binary tree, the level of its root is 1, the level of its children is 2, and so on.Return the smallest level x such t
leetcode linkYou are given the root of a binary search tree (BST) and an integer val.Find the node in the BST that the node's value equals val and ret
leetcodeGiven a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly update
leetcode linkThere are n rooms labeled from 0 to n - 1 and all the rooms are locked except for room 0. Your goal is to visit all the rooms. However, y
leetcode linkThere are n cities. Some of them are connected, while some are not. If city a is connected directly with city b, and city b is connected
leetcode linkThere are n cities numbered from 0 to n - 1 and n - 1 roads such that there is only one way to travel between two different cities (this
399\. Evaluate DivisionYou are given an array of variable pairs equations and an array of real numbers values, where equations\[i] = \[Ai, Bi] and val
leetcode linkYou are given an m x n matrix maze (0-indexed) with empty cells (represented as '.') and walls (represented as '+'). You are also given t
leetcode linkYou are given an m x n grid where each cell can have one of three values:0 representing an empty cell,1 representing a fresh orange, or2
leetcode linkGiven an integer array nums and an integer k, return the kth largest element in the array.Note that it is the kth largest element in the
leetcode linkYou have a set which contains all positive integers \[1, 2, 3, 4, 5, ...].Implement the SmallestInfiniteSet class:SmallestInfiniteSet() I
You are given two 0-indexed integer arrays nums1 and nums2 of equal length n and a positive integer k. You must choose a subsequence of indices from n
leetcode linkYou are given a 0-indexed integer array costs where costs\[i] is the cost of hiring the ith worker.You are also given two integers k and
leetcode linkWe are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you
leetcode linkYou are given two positive integer arrays spells and potions, of length n and m respectively, where spells\[i] represents the strength of
leetcode linkMediumA peak element is an element that is strictly greater than its neighbors.Given a 0-indexed integer array nums, find a peak element,
875\. Koko Eating BananasKoko loves to eat bananas. There are n piles of bananas, the ith pile has piles\[i] bananas. The guards have gone and will co
17\. Letter Combinations of a Phone NumberGiven a string containing digits from 2-9 inclusive, return all possible letter combinations that the number
Find all valid combinations of numbers that sum up to n such that the following conditions are true:Only numbers 1 through 9 are used.Each number is u
746\. Min Cost Climbing StairsYou are given an integer array cost where cost\[i] is the cost of ith step on a staircase. Once you pay the cost, you ca
790\. Domino and Tromino TilingYou have two types of tiles: a 2 x 1 domino shape and a tromino shape. You may rotate these shapes.Given an integer n,
62\. Unique PathsThere is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid\[0]\[0]). The robot tries to mov
1143\. Longest Common SubsequenceGiven two strings text1 and text2, return the length of their longest common subsequence. If there is no common subse
You are given an array prices where pricesi is the price of a given stock on the ith day, and an integer fee representing a transaction fee.Find the m