목록LeetCode (523)
넘치게 채우기
https://leetcode.com/problems/make-string-a-subsequence-using-cyclic-increments/description/leetcode - Make String a Subsequence Using Cyclic Increments문제 유형: 투 포인터, 문자열 처리문제 난이도: Medium 문제You are given two 0-indexed strings str1 and str2.In an operation, you select a set of indices in str1, and for each index i in the set, increment str1[i] to the next character cyclically. That is 'a' becomes ..
https://leetcode.com/problems/adding-spaces-to-a-string/description/leetcode - Adding Spaces to a String문제 유형: 투 포인터, 문자열 처리문제 난이도: Medium 문제You are given a 0-indexed string s and a 0-indexed integer array spaces that describes the indices in the original string where spaces will be added. Each space should be inserted before the character at the given index.For example, given s = "EnjoyYourCoff..
https://leetcode.com/problems/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence/description/leetcode - Check If a Word Occurs As a Prefix of Any Word in a Sentence문제 유형: 문자열 처리문제 난이도: Easy 문제Given a sentence that consists of some words separated by a single space, and a searchWord, check if searchWord is a prefix of any word in sentence.Return the index of the word in sentence (1-inde..
https://leetcode.com/problems/check-if-n-and-its-double-exist/description/leetcode - Check If N and Its Double Exist문제 유형: 투 포인터문제 난이도: Easy 문제Given an array arr of integers, check if there exist two indices i and j such that :i != j0 arr[i] == 2 * arr[j]서로 다른 두 인덱스 i, j에 대해서arr[i] == arr[j] *2가 있으면 true를 반환하시오. 풀이2중for문을 돌면서 서로 다른인덱스이고 2배관계인 쌍이있으면 true를, 아니면 false를 반환해준다.단, 다른인덱스임을 고려를 반드시 해줘야하..
https://leetcode.com/problems/valid-arrangement-of-pairs/description/leetcode - Valid Arrangement of Pairs문제 유형: 그래프, 오일러 경로, 오일러 회로, dfs문제 난이도: Hard 문제You are given a 0-indexed 2D integer array pairs where pairs[i] = [starti, endi]. An arrangement of pairs is valid if for every index i where 1 endi-1 == starti.Return any valid arrangement of pairs.Note: The inputs will be generated such that t..
https://leetcode.com/problems/minimum-time-to-visit-a-cell-in-a-grid/description/leetcode - Minimum Time to Visit a Cell in a Grid문제 유형: 최단 경로, 행렬, 그래프문제 난이도: Hard 문제You are given a m x n matrix grid consisting of non-negative integers where grid[row][col] represents the minimum time required to be able to visit the cell (row, col), which means you can visit the cell (row, col) only when the tim..
https://leetcode.com/problems/minimum-obstacle-removal-to-reach-corner/description/leetcode - Minimum Obstacle Removal to Reach Corner문제 유형: 최단경로, 다익스트라, 다이나믹 프로그래밍문제 난이도: Hard 문제You are given a 0-indexed 2D integer array grid of size m x n. Each cell has one of two values:0 represents an empty cell,1 represents an obstacle that may be removed.You can move up, down, left, or right from and to an..
https://leetcode.com/problems/shortest-distance-after-road-addition-queries-i/description/leetcode - Shortest Distance After Road Addition Queries I문제 유형: 최단 경로, 그래프, 다익스트라, 다이나믹 프로그래밍문제 난이도: Medium 문제You are given an integer n and a 2D integer array queries.There are n cities numbered from 0 to n - 1. Initially, there is a unidirectional road from city i to city i + 1 for all 0 queries[i] = [ui..
https://leetcode.com/problems/find-champion-ii/description/leetcode - Find Champion II문제 유형: 그래프문제 난이도: Medium 문제There are n teams numbered from 0 to n - 1 in a tournament; each team is also a node in a DAG.You are given the integer n and a 0-indexed 2D integer array edges of length m representing the DAG, where edges[i] = [ui, vi] indicates that there is a directed edge from team ui to team vi ..
https://leetcode.com/problems/sliding-puzzle/description/leetcode - Sliding Puzzle문제 유형: bfs문제 난이도: Hard 문제On an 2 x 3 board, there are five tiles labeled from 1 to 5, and an empty square represented by 0. A move consists of choosing 0 and a 4-directionally adjacent number and swapping it.The state of the board is solved if and only if the board is [[1,2,3],[4,5,0]].Given the puzzle board board,..