[문제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
[programmers] 삼각 달팽이 https://school.programmers.co.kr/learn/courses/30/lessons/68645 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 정수 n이 매개변수로 주어집니다. 다음 그림과 같이 밑변의 길이와 높이가 n인 삼각형에서 맨 위 꼭짓점부터 반시계 방향으로 달팽이 채우기를 진행한 후, 첫 행부터 마지막 행까지 모두 순서대로 합친 새로운 배열을 return 하도록 solution 함수를 완성해 주세요. 제한사항 n은 1 이상 1,000 이하입니다. 입출력 예 n result 4 [1,2,9,3,10,8,4,5,6,7] 5 [1,2.. 코딩 테스트(JAVA)/프로그래머스 2024.03.30
[문제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
[백준 2751번, 백준 10814번, LeetCode 179번] 정렬 문제 풀이 [백준 2751번] 수 정렬하기 2 https://www.acmicpc.net/problem/2751 2751번: 수 정렬하기 2 첫째 줄에 수의 개수 N(1 ≤ N ≤ 1,000,000)이 주어진다. 둘째 줄부터 N개의 줄에는 수가 주어진다. 이 수는 절댓값이 1,000,000보다 작거나 같은 정수이다. 수는 중복되지 않는다. www.acmicpc.net 접근 방법 N개의 수가 주어졌을 때, 오름차순 정렬하는 문제입니다. 1. 문자열로 입력받은 부분을 Integer.parseInt() 메서드를 통해 정수로 바꿔줍니다. 2. 배열을 만든 후 for문을 돌면서 입력받은 문자열 ➡ 정수를 차례로 넣습니다. 3. 정렬 후 출력합니다. 코드 구현 1. 실패 코드 import java.util.*; import .. 코딩 테스트(JAVA)/백준 2024.01.17