All Posts

Leetcode 209: Minimum Size Subarray Sum

Given an array of positive integers and a target value, find the minimal length of a contiguous subarray whose sum is greater than or equal to the target. If no such subarray exists, return 0.

Leetcode 238: Product of Array Except Self

Given an integer array, your task is to return an array where each element at index ‘i’ is the product of all the elements of the original array except the element at index ‘i’. You are not allowed to use division in your solution, and the algorithm must run in O(n) time.

Leetcode 497: Random Point in Non-overlapping Rectangles

You are given an array of non-overlapping axis-aligned rectangles. Each rectangle is represented by its bottom-left and top-right corner. Your task is to design a system that can pick a random integer point from the space covered by one of the given rectangles. A point on the perimeter of a rectangle is considered inside the rectangle.

Leetcode 523: Continuous Subarray Sum

Given an integer array nums and an integer k, return true if there exists a good subarray, otherwise return false. A good subarray is defined as a subarray whose length is at least 2 and the sum of its elements is a multiple of k.

Leetcode 525: Contiguous Array

Given a binary array nums, return the maximum length of a contiguous subarray with an equal number of 0 and 1.

Leetcode 528: Random Pick with Weight

You are given a 0-indexed array of positive integers w, where w[i] describes the weight of the ith index. You need to implement the function pickIndex() which randomly picks an index in the range [0, w.length - 1] (inclusive), and the probability of picking index i is w[i] / sum(w).