Algorithm
-
[Algorithm] LeetCode 53. Maximum SubarrayAlgorithm 2023. 10. 12. 00:32
53. Maximum Subarray Medium Given an integer array nums, find the subarray with the largest sum, and return its sum. Example 1: Input: nums = [-2,1,-3,4,-1,2,1,-5,4] Output: 6 Explanation: The subarray [4,-1,2,1] has the largest sum 6. Example 2: Input: nums = [1] Output: 1 Explanation: The subarray [1] has the largest sum 1. Example 3: Input: nums = [5,4,-1,7,8] Output: 23 Explanation: The suba..
-
[Algorithm] LeetCode 238.product-of-array-except-selfAlgorithm 2023. 10. 10. 23:23
238. Product of Array Except Self Medium 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 using the division operation. Example 1: Input: nums = [1,2,3,4] Out..
-
[Algorithm] LeetCode 217.contains-duplicateAlgorithm 2023. 10. 10. 23:20
217. Contains Duplicate Easy 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: true Example 2: Input: nums = [1,2,3,4] Output: false Example 3: Input: nums = [1,1,1,3,3,4,3,2,4,2] Output: true Constraints: 1
-
[Algorithm] LeetCode 121. Best Time to Buy and Sell StockAlgorithm 2023. 9. 30. 20:07
121. Best Time to Buy and Sell Stock Easy You are given an array prices where prices[i] is the price of a given stock on the ith day. 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. Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0. Example 1: Input:..
-
[LeetCode] 추천 75 문제 및 알고리즘 공부 방법Algorithm 2023. 9. 30. 18:11
주소 https://www.teamblind.com/post/New-Year-Gift---Curated-List-of-Top-75-LeetCode-Questions-to-Save-Your-Time-OaM1orEU New Year Gift - Curated List of Top 75 LeetCode Questions to Save Your Time New Year Gift to every fellow time-constrained engineer out there looking for a job, here's a list of the best LeetCode questions that teach you core concepts and techniques for each category/type of pro..
-
[Algorithm] LeetCode 7. Reverse IntegerAlgorithm 2023. 9. 26. 00:35
7. Reverse Integer Medium Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-231, 231 - 1], then return 0. Assume the environment does not allow you to store 64-bit integers (signed or unsigned). Example 1: Input: x = 123 Output: 321 Example 2: Input: x = -123 Output: -321 Example 3: Input: x = 120 O..
-
[Algorithm] LeetCode 57. Insert IntervalAlgorithm 2023. 1. 21. 18:06
57. Insert Interval Medium You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end of the ith interval and intervals is sorted in ascending order by starti. You are also given an interval newInterval = [start, end] that represents the start and end of another interval. Insert newInterval into intervals such that intervals ..