You are given an array of strings words and a string chars.A string is good if it can be formed by characters from chars (each character can only be u
Write a function that reverses a string. The input string is given as an array of characters char\[].Do not allocate extra space for another array, yo
A valid parentheses string is either empty (""), "(" + A + ")", or A + B, where A and B are valid parentheses strings, and + represents string concate
Write a function to delete a node in a singly-linked list. You will not be given access to the head of the list, instead you will be given access to t
You have n tiles, where each tile has one letter tilesi printed on it.Return the number of possible non-empty sequences of letters you can make using
Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1.Sort the elements of arr1 such that the r
1185. Day of the Week Given a date, return the corresponding day of the week for that date. The input is given as three integers representing the day
A dieter consumes caloriesi calories on the i-th day. Given an integer k, for every consecutive sequence of k days (caloriesi, caloriesi+1, ..., calor
Students are asked to stand in non-decreasing order of heights for an annual photo.Return the minimum number of students that must move in order for a
Given an integer array nums, find the sum of the elements between indices left and right inclusive, where (left <= right).Implement the NumArray cl
An axis-aligned rectangle is represented as a list x1, y1, x2, y2, where (x1, y1) is the coordinate of its bottom-left corner, and (x2, y2) is the coo
Given an n x n binary matrix image, flip the image horizontally, then invert it, and return the resulting image.To flip an image horizontally means th
Given a time represented in the format "HH:MM", form the next closest time by reusing the current digits. There is no limit on how many times a digit
Given a string path, which is an absolute path (starting with a slash '/') to a file or directory in a Unix-style file system, convert it to the simpl
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.You may assume that each inpu
We are given two strings, A and B.A shift on A consists of taking string A and moving the leftmost character to the rightmost position. For example, i
Given an array arr of 4 digits, find the latest 24-hour time that can be made using each digit exactly once.24-hour times are formatted as "HH:MM", wh
Given an array nums containing n distinct numbers in the range 0, n, return the only number in the range that is missing from the array.Follow up: Cou
The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding one
Given an array of integers arr, replace each element with its rank.The rank represents how large the element is. The rank has the following rules:Rank
You 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 representing
We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11).No
Given the root of a binary search tree and the lowest and highest boundaries as low and high, trim the tree so that all its elements lies in low, high
You are given an array of logs. Each log is a space-delimited string of words, where the first word is the identifier.There are two types of logs:Lett
X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. Each digit must be rotat
Given a string s, return the longest palindromic substring in s.s\[i:] 마다 재귀 돌려서 시작값과 끝값이 같은지 확인ccc 같은 case는 통과 X뭔가 재귀를 썼던 거 같은데... 까먹었네요...^^DP 를 써야했
Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in
Given an array A of strings made only from lowercase letters, return a list of all characters that show up in all strings within the list (including d
Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times.Follow-up: Could you solve the problem in linear time and in O
Every valid email consists of a local name and a domain name, separated by the '@' sign. Besides lowercase letters, the email may contain one or more
Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range -231
오랜만에 알고리즘~Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it wou
You are given a string s representing an attendance record for a student where each character signifies whether the student was absent, late, or prese
랜덤에서 마소 문제를 또 만났어요~Given an n x n binary matrix image, flip the image horizontally, then invert it, and return the resulting image.To flip an image ho
Given an array nums and a value val, remove all instances of that value in-place and return the new length.Do not allocate extra space for another arr
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
뜻밖의 유튜브 감상으로 인해... 제시간에 안풂 ㅎ..X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different fro
You are given a string s representing an attendance record for a student where each character signifies whether the student was absent, late, or prese
전에 풀었던 아마존 문제 였다^^An axis-aligned rectangle is represented as a list x1, y1, x2, y2, where (x1, y1) is the coordinate of its bottom-left corner, and (
Given a string s and an integer array indices of the same length.The string s will be shuffled such that the character at the ith position moves to in
놀다가 한 17분 남았을 때부터 풀었다...^^We have two special characters. The first character can be represented by one bit 0. The second character can be represented
애플이 문제~단순하게 푸는 것도 괜찮다는 것을 느낌Given an array words of strings made only from lowercase letters, return a list of all characters that show up in all stri
Given the root of a Binary Search Tree and a target number k, return true if there exist two elements in the BST such that their sum is equal to the g
마존이 문제네요Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1.Sort the elements of arr1 such th
Given the root of a binary search tree and the lowest and highest boundaries as low and high, trim the tree so that all its elements lies in low, high
처음 만난 아이들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
마존이 문제.. 한 세번째 만남인듯...You are given an array of strings words and a string chars.A string is good if it can be formed by characters from chars (each c
얘도 마존이 문제~Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.You may assume that
A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com
You are climbing a staircase. It takes n steps to reach the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb t
이거 3문제도 나오는 거였구나...Given a non-empty array of decimal digits representing a non-negative integer, increment one to the integer.The digits are stored s
easy 두 문제~Given the root of a binary tree, invert the tree, and return its root.그냥 pre-order 로 순회하면서 left 와 right 를 swap반복문을 이용한 방법, stack 사용left, rig
easy 와 hard 라뇨...Given a string paragraph and a string array of the banned words banned, return the most frequent word that is not banned. It is guara
미듐이 두개...Given the root of a binary tree, each node in the tree has a distinct value.After deleting all nodes with a value in to_delete, we are left w
두번째 문제는 시간 끝나자마자 풀었음...^^Given an array of integers nums and an integer limit, return the size of the longest non-empty subarray such that the absolut
두번째 문제는.. 딴 문제로 착각해서 의도치 않은 3 문제 풀기...^^You are assigned to put some amount of boxes onto one truck. You are given a 2D array boxTypes, where boxTypes
You have n tiles, where each tile has one letter tilesi printed on it.Return the number of possible non-empty sequences of letters you can make using
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 case
You are assigned to put some amount of boxes onto one truck. You are given a 2D array boxTypes, where boxTypesi = numberOfBoxesi, numberOfUnitsPerBoxi
Given two stings ransomNote and magazine, return true if ransomNote can be constructed from magazine and false otherwise.Each letter in magazine can o
Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique and you may return the resu
Given a string s, reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.string 을 rev
외동이면 Lonely Nodelevel-order 로 보면서 left, right 중에 하나만 있으면 ans 에 appendDesign a stack which supports the following operations.Implement the CustomStack
A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com
In a deck of cards, each card has an integer written on it.Return true if and only if you can choose X >= 2 such that it is possible to split the enti
Given the root of an n-ary tree, return the postorder traversal of its nodes' values.Nary-Tree input serialization is represented in their level order
Given the head of a linked list and an integer val, remove all the nodes of the linked list that has Node.val == val, and return the new head.head 앞에
Given an array of integers arr, sort the array by performing a series of pancake flips.In one pancake flip we do the following steps:Choose an integer
Given an array nums. We define a running sum of an array as runningSumi = sum(nums0…numsi).Return the running sum of nums.문제 그대로 누적합을 ans 에 append같은 건
Given a m x n matrix grid which is sorted in non-increasing order both row-wise and column-wise, return the number of negative numbers in grid.문제 고대로
size 만큼 꽉 차면 맨 처음 값 pop 해주기아니면 deque 써서 popleft 해도 될듯lintcode 야 고마워..^^Given a list of dominoes, dominoesi = a, b is equivalent to dominoesj = c, d if
Given a fixed length array arr of integers, duplicate each occurrence of zero, shifting the remaining elements to the right.Note that elements beyond
Given a string s and an integer k, reverse the first k characters for every 2k characters counting from the start of the string.If there are fewer tha
You are given row x col grid representing a map where gridi = 1 represents land and gridi = 0 represents water.Grid cells are connected horizontally/v
Given two string arrays word1 and word2, return true if the two arrays represent the same string, and false otherwise.A string is represented by an ar
A sentence sentence is given, composed of words separated by spaces. Each word consists of lowercase and uppercase letters only.We would like to conve
Given an unsorted array of integers nums, return the length of the longest continuous increasing subsequence (i.e. subarray). The subsequence must be
An image is represented by an m x n integer grid image where imagei represents the pixel value of the image.You are also given three integers sr, sc,
마존아 어제 좋았잖아...☆There is a ball in a maze with empty spaces and walls. The ball can go through empty spaces by rolling up, down, left or right, but it
Given a string s, return the string after replacing every uppercase letter with the same lowercase letter.아스키로 계산하려 했는데 그거나 이거나..^^You are given a lis
Given a string s, the power of the string is the maximum length of a non-empty substring that contains only one unique character.Return the power of t
In an election, the i-th vote was cast for personsi at time timesi.Now, we would like to implement the following query function: TopVotedCandidate.q(i
1281. Subtract the Product and Sum of Digits of an Integer Given an integer number n, return the difference between the product of its digits and the
Tic-tac-toe is played by two players A and B on a 3 x 3 grid.Here are the rules of Tic-Tac-Toe:Players take turns placing characters into empty square
timestamp 기준으로 username, timestamp, website 모두 정렬dic 에 username 과 website 를 mappingfindPattern 함수를 만들어서 각 유저의 website 패턴 조합을 모두 찾기=> 길이가 3 이 되면 패턴 추가
You are given an m x n integer grid accounts where accountsi is the amount of money the ith customer has in the jth bank. Return the wealth that the r
958. Check Completeness of a Binary Tree Given the root of a binary tree, determine if it is a complete binary tree. In a complete binary tree, every
Given an array of integers arr, return true if and only if it is a valid mountain array.Recall that arr is a mountain array if and only if:arr.length
Given the array nums consisting of 2n elements in the form x1,x2,...,xn,y1,y2,...,yn.Return the array in the form x1,y1,x2,y2,...,xn,yn.nums 를 반 나눠서 각
https://leetcode.com/problems/armstrong-number/num 에 n 복사 후한자리씩 n제곱한 값은 ans 에 더해주고ans 와 n 비교해서 같으면 True, 다르면 False return문제를 꼼꼼히 읽자..^^https:
https://leetcode.com/problems/buddy-strings/직접 swap 하는 건 넘 헤비할 거 같아서... 그냥 모든 경우를 확인해줌우선 서로 길이 비교 => False / 서로 알파벳의 종류 비교 => Falses\[i] != goal\
https://leetcode.com/problems/first-bad-version/그냥 for 문으로 돌렸더니 타임리밋이길래 Binary Search 로 하니까 통과~https://leetcode.com/problems/snapshot-array/
https://www.acmicpc.net/problem/4153a, b, c 를 입력받아 피타고라스의 정리를 만족하는지 확인모두 0 이면 breakhttps://www.acmicpc.net/problem/5430R 은 flag 로 판단하도록 하고 (