분류 전체보기
-
[LeetCode] 1328. Break a Palindrome알고리즘 문제 풀이 2021. 9. 24. 15:21
문제 출처: https://leetcode.com/problems/break-a-palindrome/ Break a Palindrome - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 영어 소문자로 이루어진 회문 문자열 palindrome이 주어지면, 이 문자열을 회문이 아닌 문자열로 만들기 위해 정확히 한 개의 문자를 다른 영어 소문자로 대체하고, 가능한 결과 중 사전 순에서 가장 작은 문자열을 찾아라. 결과 문자열을 반환하라. 만약 어떤 문자를 대체하..
-
[LeetCode] 1239. Maximum Length of a Concatenated String with Unique Characters알고리즘 문제 풀이 2021. 9. 23. 11:33
문제 출처: https://leetcode.com/problems/maximum-length-of-a-concatenated-string-with-unique-characters/ Maximum Length of a Concatenated String with Unique Characters - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 문자열 배열 arr이 주어진다. 문자열 s는 유일한 문자를 갖는 arr의 하위 시퀀스의 연결이다. s의 가능한 최대 ..
-
[LeetCode] 54. Spiral Matrix알고리즘 문제 풀이 2021. 9. 17. 14:16
문제 출처: https://leetcode.com/problems/spiral-matrix/ Spiral Matrix - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 $m \times n$ $martix$의 모든 원소를 나선 순서로 반환하라. 예제 Input: matrix = [[1,2,3],[4,5,6],[7,8,9]] Output: [1,2,3,6,9,8,7,4,5] Input: matrix = [[1,2,3,4],[5,6,7,8],[9,10,11,1..
-
[LeetCode] 978. Longest Turbulent Subarray알고리즘 문제 풀이 2021. 9. 16. 14:21
문제 출처: https://leetcode.com/problems/longest-turbulent-subarray/ Longest Turbulent Subarray - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 정수 배열 arr에서 격동(turbulent) 하위 배열 중 가장 큰 크기를 반환하라. 하위 배열이 격동(turbulent)하다는 것은 각 인접 원소 쌍의 비교 부호가 뒤집히는 것을 말한다. 더 형식적으로 표현하면, 하위 배열 $[arr[i], ..
-
[LeetCode] 917. Reverse Only Letters알고리즘 문제 풀이 2021. 9. 15. 10:13
문제 출처: https://leetcode.com/problems/reverse-only-letters/ Reverse Only Letters - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 문자열 s를 다음 규칙에 따라 역순으로 배치하라: 영어 알파벳이 아닌 다른 모든 문자는 원래 위치를 유지하라. 영어 알파벳(대·소문자)은 역순으로 배치하라. s를 뒤집은 후의 문자열을 반환하라. 예제 Input: s = "ab-cd" Output: "dc-ba" In..
-
[LeetCode] 1189. Maximum Number of Balloons알고리즘 문제 풀이 2021. 9. 14. 17:43
문제 출처: https://leetcode.com/problems/maximum-number-of-balloons/ Maximum Number of Balloons - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 문자열 text가 주어지면, text의 문자를 사용하여 가능한 많은 "ballon" 단어를 만들고자 한다. text안에 있는 문자는 최대 한 번씩만 사용 가능하다. 만들 수 있는 "ballon"의 최대 개수를 반환하라. 예제 Input: text..
-
[LeetCode] 882. Reachable Nodes In Subdivided Graph알고리즘 문제 풀이 2021. 9. 13. 16:38
문제 출처: https://leetcode.com/problems/reachable-nodes-in-subdivided-graph/ Reachable Nodes In Subdivided Graph - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 0 ~ n-1로 이름 붙여진 n개의 노드로 구성된 무방향 그래프("오리지널 그래프")가 주어진다. 당신은 그래프의 간선을 세세하기 나누고 새로운 노드를 만들어 넣기로 하였다. 그래프는 2차원 배열 edges로 주어..
-
[LeetCode] 764. Largest Plus Sign알고리즘 문제 풀이 2021. 9. 10. 17:21
문제 출처: https://leetcode.com/problems/largest-plus-sign/ Largest Plus Sign - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 정수 $n$이 주어진다. $n \times n$의 이진 격자 $grid$가 있으며, 이 격자는 배열 $mines$에 있는 일부 위치를 제외하고 1로 초기화되어 있다. 배열 $mines$의 $i^{th}$ 원소는 $mines[i] = [x_i, y_i]$로 정의되며, $grid[..