随笔分类 -  Data Structures

摘要:Given an array nums, we call (i, j) an important reverse pair if i < j and nums[i] > 2*nums[j]. You need to return the number of important reverse pai 阅读全文
posted @ 2021-02-18 08:35 Review->Improve 阅读(194) 评论(0) 推荐(0)
摘要:You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smal 阅读全文
posted @ 2021-02-18 02:41 Review->Improve 阅读(647) 评论(0) 推荐(0)
摘要:A Range Module is a module that tracks ranges of numbers. Your task is to design and implement the following interfaces in an efficient manner. addRan 阅读全文
posted @ 2021-02-17 01:45 Review->Improve 阅读(246) 评论(0) 推荐(0)
摘要:You are given a 0-indexed integer array nums and an integer k. You are initially standing at index 0. In one move, you can jump at most k steps forwar 阅读全文
posted @ 2021-02-16 12:05 Review->Improve 阅读(604) 评论(0) 推荐(0)
摘要:Given a rows * columns matrix mat of ones and zeros, return how many submatrices have all ones. Example 1: Input: mat = [[1,0,1], [1,1,0], [1,1,0]] Ou 阅读全文
posted @ 2021-02-16 06:13 Review->Improve 阅读(849) 评论(0) 推荐(0)
摘要:Problem Link: C - Mandarin Orange The problem can be converted to as such: Given an array A of positive integers, find out the the maximum product val 阅读全文
posted @ 2021-02-16 01:08 Review->Improve 阅读(114) 评论(0) 推荐(0)
摘要:Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. Example 1: Input: [[1,1],[2,2],[3,3]] Output: 3 Ex 阅读全文
posted @ 2021-02-07 09:25 Review->Improve 阅读(63) 评论(0) 推荐(0)
摘要:You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if and only if both the w 阅读全文
posted @ 2021-02-06 03:42 Review->Improve 阅读(146) 评论(0) 推荐(0)
摘要:You are given a list of integers nums and an integer k. Consider an operation where you increment any one element once(increase by 1). Given that you 阅读全文
posted @ 2021-02-03 11:58 Review->Improve 阅读(371) 评论(0) 推荐(0)
摘要:An undirected graph of n nodes is defined by edgeList, where edgeList[i] = [ui, vi, disi] denotes an edge between nodes ui and vi with distance disi. 阅读全文
posted @ 2020-12-22 10:35 Review->Improve 阅读(501) 评论(0) 推荐(0)
摘要:We have an array A of non-negative integers. For every (contiguous) subarray B = [A[i], A[i+1], ..., A[j]] (with i <= j), we take the bitwise OR of al 阅读全文
posted @ 2020-12-05 03:41 Review->Improve 阅读(134) 评论(0) 推荐(0)
摘要:Given a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. Example 1: Input: matri 阅读全文
posted @ 2020-09-24 04:15 Review->Improve 阅读(164) 评论(0) 推荐(0)
摘要:Given two strings s and t, you want to transform string s into string t using the following operation any number of times: Choose a non-empty substrin 阅读全文
posted @ 2020-09-15 22:32 Review->Improve 阅读(466) 评论(0) 推荐(0)
摘要:I have run into 2 different problems that can be solved using binary lifting. Then there is second thread's tree basics youtube video that talks about 阅读全文
posted @ 2020-08-25 11:53 Review->Improve 阅读(256) 评论(0) 推荐(0)
摘要:Given an array arr that represents a permutation of numbers from 1 to n. You have a binary string of size n that initially has all its bits set to zer 阅读全文
posted @ 2020-08-25 01:47 Review->Improve 阅读(509) 评论(0) 推荐(0)
摘要:Given two arrays of length m and n with digits 0-9 representing two numbers. Create the maximum number of length k <= m + n from digits of the two. Th 阅读全文
posted @ 2020-08-21 11:37 Review->Improve 阅读(306) 评论(0) 推荐(0)
摘要:Given an array of positive integers target and an array initial of same size with all zeros. Return the minimum number of operations to form a target  阅读全文
posted @ 2020-07-27 12:26 Review->Improve 阅读(882) 评论(0) 推荐(1)
摘要:Given an array of integers arr and an integer target. You have to find two non-overlapping sub-arrays of arr each with sum equal target. There can be 阅读全文
posted @ 2020-06-18 22:33 Review->Improve 阅读(2072) 评论(0) 推荐(0)
摘要:Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the pers 阅读全文
posted @ 2020-06-13 06:39 Review->Improve 阅读(254) 评论(0) 推荐(0)
摘要:Return the length of the shortest, non-empty, contiguous subarray of A with sum at least K. If there is no non-empty subarray with sum at least K, ret 阅读全文
posted @ 2020-06-11 07:49 Review->Improve 阅读(415) 评论(0) 推荐(0)