Leetcode 3: Longest Substring Without Repeating Characters

Problem Statement Description Given a string s, find the length of the longest substring without repeating characters. Examples Example 1: Input: s = "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2: Input: s = "bbbbb" Output: 1 Explanation: The answer is "b", with the length of 1. Example 3: Input: s = "pwwkew" Output: 3 Explanation: The answer is "wke", with the length of 3....

April 16, 2023 · 3 min · 434 words · Me

Leetcode 973: K Closest Points to Origin

Problem Statement Description Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane and an integer k, return the k closest points to the origin (0, 0). The distance between two points on the X-Y plane is the Euclidean distance (i.e., √(x1 - x2)2 + (y1 - y2)2). You may return the answer in any order. The answer is guaranteed to be unique (except for the order that it is in)....

April 15, 2023 · 3 min · 499 words · Me

Leetcode 238: Product of Array Except Self

Problem Statement 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]. 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. Examples Example 1: Input: nums = [1,2,3,4] Output: [24,12,8,6] Example 2: Input: nums = [-1,1,0,-3,3] Output: [0,0,9,0,0] Constraints 2 <= nums....

February 20, 2023 · 3 min · 509 words · Me

Leetcode 53: Maximum Subarray

Problem Statement Description Given an integer array nums, find the subarray with the largest sum, and return its sum. Examples 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 subarray [5,4,-1,7,8] has the largest sum 23....

January 24, 2023 · 4 min · 692 words · Me

Leetcode 57 Insert Interval

Introduction Sebastian (🧔🏼) and Carl (👨) been working through the Grind 75 to prepare for their upcoming interviews at MAANG. Back in university they made a great team and they believe that they can nail their coding interview prep by explaining their Leetcode solutions to each other. Sebastian meets with Carl at the hip little coffee show down on 8th street for their bi-weekly group study session. 🧔🏼 “I’ll start off with Leetcode 57, the insert interval problem....

January 7, 2023 · 5 min · 1029 words · Me