-에 해당하는 글 224

  1. [LeetCode] Max Number of K-Sum Pairs 2024.12.11

    https://leetcode.com/problems/max-number-of-k-sum-pairs/description/?envType=study-plan-v2&envId=leetcode-75 You are given an integer array nums and an integer k.In one operation, you can pick two numbers from the array whose sum equals k and remove them from the array.Return the maximum number of operations you can perform on the array. Example 1:Input: nums = [1,2,3,4], k = 5Output: 2Explanati..


  2. [LeetCode] Product of Array Except Self 2024.11.24

    https://leetcode.com/problems/product-of-array-except-self/description/?envType=study-plan-v2&envId=leetcode-75 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].The product of any prefix or suffix of nums is guaranteed to fit in a 32-bit integer.You must write an algorithm that runs in O(n) time and without..


  3. [LeetCode] Container With Most Water 2024.11.19

    https://leetcode.com/problems/container-with-most-water/description/?envType=study-plan-v2&envId=leetcode-75 You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]).Find two lines that together with the x-axis form a container, such that the container contains the most water.Return the maximum a..


  4. [LeetCode] In Subsequence 2024.10.30

    https://leetcode.com/problems/is-subsequence/description/?envType=study-plan-v2&envId=leetcode-75 Given two strings s and t, return true if s is a subsequence of t, or false otherwise.A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., "ace"..


  5. [LeetCode] Move Zeroes 2024.09.20

    https://leetcode.com/problems/move-zeroes/description/?envType=study-plan-v2&envId=leetcode-75 Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements.Note that you must do this in-place without making a copy of the array. Example 1:Input: nums = [0,1,0,3,12]Output: [1,3,12,0,0]Example 2:Input: nums = [0]Output: [0] Constraints:1 -..


  6. [LeetCode] String Compression 2024.09.20

    https://leetcode.com/problems/string-compression/description/?envType=study-plan-v2&envId=leetcode-75 Given an array of characters chars, compress it using the following algorithm:Begin with an empty string s. For each group of consecutive repeating characters in chars:If the group's length is 1, append the character to s.Otherwise, append the character followed by the group's length.The compres..


  7. [LeetCode] Increasing Triplet Subsequence 2024.09.19

    https://leetcode.com/problems/increasing-triplet-subsequence/description/?envType=study-plan-v2&envId=leetcode-75 Given an integer array nums, return true if there exists a triple of indices (i, j, k) such that i  and nums[i]  Example 1:Input: nums = [1,2,3,4,5]Output: trueExplanation: Any triplet where i Example 2:Input: nums = [5,4,3,2,1]Output: falseExplanation: No triplet exists.Example 3:In..


  8. [LeetCode] Reverse ... a String 2024.09.17

    비슷한 두 개의 문제를 풀었다. 첫 번째 문제 (Reverse Vowels of a String)https://leetcode.com/problems/reverse-vowels-of-a-string/description/?envType=study-plan-v2&envId=leetcode-75Given a string s, reverse only all the vowels in the string and return it.The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and upper cases, more than once. Example 1:Input: s = "IceCreAm"Output: "AceCreIm"E..


  9. [LeetCode] Can Place Flowers 2024.09.16

    https://leetcode.com/problems/can-place-flowers/description/?envType=study-plan-v2&envId=leetcode-75 You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots.Given an integer array flowerbed containing 0's and 1's, where 0 means empty and 1 means not empty, and an integer n, return true if n new flowers can be plante..


  10. [LeetCode] Kids With the Greatest Number of Candies 2024.09.16

    https://leetcode.com/problems/kids-with-the-greatest-number-of-candies/description/?envType=study-plan-v2&envId=leetcode-75 There are n kids with candies. You are given an integer array candies, where each candies[i] represents the number of candies the ith kid has, and an integer extraCandies, denoting the number of extra candies that you have.Return a boolean array result of length n, where re..