본문 바로가기

코딩 테스트14

240322 LeetCode 문제 풀이 234. Palindrome Linked List https://leetcode.com/problems/palindrome-linked-list/description/?envType=daily-question&envId=2024-03-22 1) 문제 설명 Given the head of a singly linked list, return true if it is a palindrome or false otherwise. Example 1: Input: head = [1,2,2,1] Output: true Example 2: Input: head = [1,2] Output: false 2) 제한 사항 The number of nodes in the list is in the range [1, 105]. 0 2024. 3. 22.
240321 LeetCode 문제 풀이 206. Reverse Linked List https://leetcode.com/problems/reverse-linked-list/description/?envType=daily-question&envId=2024-03-21 1) 문제 설명 Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1: Input: head = [1,2,3,4,5] Output: [5,4,3,2,1] Example 2: Input: head = [1,2] Output: [2,1] Example 3: Input: head = [] Output: [] 2) 제한 사항 The number of nodes in .. 2024. 3. 21.
240314 LeetCode 문제 풀이 930. Binary Subarrays With Sum https://leetcode.com/problems/binary-subarrays-with-sum/description/?envType=daily-question&envId=2024-03-14 1) 문제 설명 Given a binary array nums and an integer goal, return the number of non-empty subarrays with a sum goal. A subarray is a contiguous part of the array. Example 1: Input: nums = [1,0,1,0,1], goal = 2 Output: 4 Explanation: The 4 subarrays are bolded a.. 2024. 3. 14.
240313 LeetCode 문제 풀이 2485. Find the Pivot Integer https://leetcode.com/problems/find-the-pivot-integer/description/?envType=daily-question&envId=2024-03-13 1) 문제 설명 Given a positive integer n, find the pivot integer x such that: The sum of all elements between 1 and x inclusively equals the sum of all elements between x and n inclusively. Return the pivot integer x. If no such integer exists, return -1. It is guaran.. 2024. 3. 13.
240311 LeetCode 문제 풀이 791. Custom Sort String https://leetcode.com/problems/custom-sort-string/description/?envType=daily-question&envId=2024-03-11 1) 문제 설명 You are given two strings order and s. All the characters of order are unique and were sorted in some custom order previously. Permute the characters of s so that they match the order that order was sorted. More specifically, if a character x occurs before a char.. 2024. 3. 11.
240308 LeetCode 문제 풀이 3005. Count Elements With Maximum Frequency https://leetcode.com/problems/count-elements-with-maximum-frequency/description/?envType=daily-question&envId=2024-03-08 1) 문제 설명 You are given an array nums consisting of positive integers. Return the total frequencies of elements in nums such that those elements all have the maximum frequency. The frequency of an element is the number of occurrences .. 2024. 3. 9.