CodingTest에 해당하는 글 63

  1. [LeetCode] Valid Palindrome 2025.12.15

    https://leetcode.com/problems/valid-palindrome/description/ A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.Given a string s, return true if it is a palindrome, or false otherwise. Example 1:Input: s = "A man, a plan,..


  2. [LeetCode] 3Sum 2025.12.04

    https://leetcode.com/problems/3sum/description/ Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.Notice that the solution set must not contain duplicate triplets. Example 1:Input: nums = [-1,0,1,2,-1,-4]Output: [[-1,-1,2],[-1,0,1]]Explanation: nums[0] + nums[1] + nums[2] = (-1) + 0 + 1 = 0...


  3. [LeetCode] Climbing Stairs 2025.11.26

    https://leetcode.com/problems/climbing-stairs/You are climbing a staircase. It takes n steps to reach the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Example 1:Input: n = 2Output: 2Explanation: There are two ways to climb to the top.1. 1 step + 1 step2. 2 steps Example 2:Input: n = 3Output: 3Explanation: There are three ways to climb to th..


  4. [LeetCode] Valid Anagram 2025.11.24

    https://leetcode.com/problems/valid-anagram/description/ Given two strings s and t, return true if t is an anagram of s, and false otherwise. Example 1:Input: s = "anagram", t = "nagaram"Output: trueExample 2:Input: s = "rat", t = "car"Output: false Constraints:1 s and t consist of lowercase English letters.The problem was to check whether two given strings contain the same kinds of characters i..


  5. [LeetCode] Longest Consecutive Sequence 2025.11.21

    https://leetcode.com/problems/longest-consecutive-sequence/description/Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence.You must write an algorithm that runs in O(n) time. Example 1:Input: nums = [100,4,200,1,3,2]Output: 4Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its length is 4.Example 2:Input: nums ..


  6. [LeetCode] Top K Frequent Elements 2025.11.21

    https://leetcode.com/problems/top-k-frequent-elements/description/Given an integer array nums and an integer k, return the k most frequent elements.You may return the answer in any order. Example 1:Input: nums = [1,1,1,2,2,3], k = 2Output: [1,2] Example 2:Input: nums = [1], k = 1Output: [1] Example 3:Input: nums = [1,2,1,2,1,2,3,1,3,2], k = 2Output: [1,2] Constraints:1 -10^4 k is in the range [1..


  7. [LeetCode] contains Duplicate 2025.11.19

    https://leetcode.com/problems/contains-duplicate/description/ Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct. Example 1:Input: nums = [1,2,3,1]Output: trueExplanation:The element 1 occurs at the indices 0 and 3. Example 2:Input: nums = [1,2,3,4]Output: falseExplanation:All elements are distinct. Example 3:I..


  8. [LeetCode] Guess Number Higher or Lower 2025.07.17

    https://leetcode.com/problems/guess-number-higher-or-lower/description/?envType=study-plan-v2&envId=leetcode-75We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess. You call a pre-defined API int guess(int num), which r..


  9. [LeetCode] Edit Distance 2025.07.09

    https://leetcode.com/problems/edit-distance/description/?envType=study-plan-v2&envId=leetcode-75 Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2.You have the following three operations permitted on a word:Insert a characterDelete a characterReplace a characterExample 1: Input: word1 = "horse", word2 = "ros" Output: 3Explanation: hors..


  10. [LeetCode] Best Time to Buy and Sell Stock with Transaction Fee 2025.07.02

    https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/description/?envType=study-plan-v2&envId=leetcode-75You are given an array prices where prices[i] is the price of a given stock on the ith day, and an integer fee representing a transaction fee. Find the maximum profit you can achieve. You may complete as many transactions as you like, but you need to pay the tran..