[문제15][LeetCode] 206. 역순 연결 리스트 https://leetcode.com/problems/reverse-linked-list/description/ Given the head of a singly linked list, reverse the list, and return the reversed list. Constraints: The number of nodes in the list is the range [0, 5000] -5000 코딩 테스트(JAVA)/리트코드 2024.04.06
[문제14][LeetCode] 21. 두 정렬 리스트의 병합 https://leetcode.com/problems/merge-two-sorted-lists/ You are given the heads of two sorted linked lists list1 and list2. Merge the two lists into one sorted list. The list should be made by splicing together the nodes of the first two lists. Return the head of the merged linked list. Constraints: The number of nodes in both lists is in the range [0, 50]. -100 코딩 테스트(JAVA)/리트코드 2024.04.06
[문제13][LeetCode] 234. 팰린드롬 연결 리스트 https://leetcode.com/problems/palindrome-linked-list/ Given the head of a singly linked list, return true if it is a palindrome or false otherwise. * A palindrome is a sequence that reads the same forward and backward. Example 1: Input: head = [1,2,2,1] Output: true Example 2: Input: head = [1,2] Output: false Constraints: The number of nodes in the list is in the range [1, 10⁵] 0 코딩 테스트(JAVA)/리트코드 2024.04.04
[문제12][LeetCode] 121. 주식을 사고팔기 가장 좋은 시점 https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/ You are given an array prices where prices[i] is the price of a given stock on the ith day. 주어진 배열 prices에서 prices[i]는 i번째 날의 특정 주식 가격입니다. You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock. 하나의 주식을 사는 날과 미래의 다른 날에 그 주식을 판매하는 것으로 이익을 극대화.. 코딩 테스트(JAVA)/리트코드 2024.03.30
[문제11][LeetCode] 238. 자신을 제외한 배열의 곱 https://leetcode.com/problems/product-of-array-except-self/description/ Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i]. 정수 배열 nums가 주어졌을 때, answer[i]가 nums[i]를 제외한 nums의 모든 요소의 곱과 같게 하는 배열 answer를 반환해주세요. The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer. nums의 어떤 접두사나 접.. 코딩 테스트(JAVA)/리트코드 2024.03.29
[문제10][LeetCode] 561. 배열 파티션 I https://leetcode.com/problems/array-partition/ Given an integer array nums of 2n integers, group these integers into n pairs (a1, b1), (a2, b2), ..., (an, bn) such that the sum of min(ai, bi) for all i is maximized. Return the maximized sum. 2n개의 정수로 구성된 정수 배열 nums가 주어졌을 때, 이 정수들을 n 쌍의 (a1, b1), (a2, b2), ..., (an, bn)과 같이 그룹화하여 모든 i에 대해 min(ai, bi)의 합이 최대화되도록 합니다. 최대화된 합을 반환하세요. Example 1: Inpu.. 코딩 테스트(JAVA)/리트코드 2024.03.29
[LeetCode] 1091. Shortest Path in Binary Matrix https://leetcode.com/problems/shortest-path-in-binary-matrix/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 Given an n x n binary matrix grid, return the length of the shortest clear path in the matrix. If the.. 코딩 테스트(JAVA)/리트코드 2024.01.24
[LeetCode] 200. Number of Islands https://leetcode.com/problems/number-of-islands/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of is.. 코딩 테스트(JAVA)/리트코드 2024.01.24
[LeetCode] 785. Is Graph Bipartite? https://leetcode.com/problems/is-graph-bipartite/description/ Is Graph Bipartite? - LeetCode Can you solve this real interview question? Is Graph Bipartite? - There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array graph, where graph[u] is an array of nodes that node u is adjacent to. Mo leetcode.com 각 노드의 번호가 0에서 n-1 사이인 노드가 n개인 방향성 없.. 코딩 테스트(JAVA)/리트코드 2024.01.15
[LeetCode] 32. Longest Valid Parentheses https://leetcode.com/problems/longest-valid-parentheses/description/ Longest Valid Parentheses - LeetCode Can you solve this real interview question? Longest Valid Parentheses - Given a string containing just the characters '(' and ')', return the length of the longest valid (well-formed) parentheses substring. Example 1: Input: s = "(()" Output: 2 Explanat leetcode.com Given a string containing.. 코딩 테스트(JAVA)/리트코드 2024.01.15