Median of Two Sorted Arrays - Leetcode 4Problem - Leetcode Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Example 1: Input: nums1 = [1,3], nums2 = [2] Output: 2.00000 ...Jan 7, 2024·3 min read
Search a 2D Matrix - Leetcode 74Problem - Leetcode You are given an m x n integer matrix matrix with the following two properties: Each row is sorted in non-decreasing order. The first integer of each row is greater than the last integer of the previous row. Given an integer ta...Oct 6, 2023·4 min read
Binary Search - Leetcode 704Problem - Leetcode Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1. You must write an algorithm with O...Oct 5, 2023·3 min read
Largest Rectangle in Histogram - Leetcode 84Problem - Leetcode Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram. Example 1: Input: heights = [2,1,5,6,2,3]Output: 10Explanatio...Oct 5, 2023·3 min read
Car Fleet - Leetcode 853Problem - Leetcode There are n cars going to the same destination along a one-lane road. The destination is targetmiles away. You are given two integer array position and speed, both of length n, where position[i] is the position of the i<sup>th</sup...Oct 3, 2023·4 min read
Daily Temperatures - Leetcode 739Problem - Leetcode Given an array of integers temperatures represent the daily temperatures, return an arrayanswer such that answer[i] is the number of days you have to wait after the i<sup>th</sup> day to get a warmer temperature. If there is no fut...Sep 19, 2023·3 min read
Generate Parentheses - Leetcode 22Problem - Leetcode Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example 1: Input: n = 3 Output: ["((()))","(()())","(())()","()(())","()()()"] Example 2: Input: n = 1 Output: ["()"] Constr...Sep 15, 2023·3 min read