随笔分类 - LeetCode
摘要:Given the of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum
阅读全文
摘要:In a 1 million by 1 million grid, the coordinates of each grid square are . We start at the square and want to reach the square. Each move, we can wal
阅读全文
摘要:A boomerang is a set of 3 points that are all distinct and not in a straight line. Given a list of three points in the plane, return whether these poi
阅读全文
摘要:We write the integers of and (in the order they are given) on two separate horizontal lines. Now, we may draw connecting lines : a straight line conne
阅读全文
摘要:Given a 2 dimensional of integers, each value in the grid represents the color of the grid square at that location. Two squares belong to the same con
阅读全文
摘要:Three stones are on a number line at positions , , and . Each turn, you pick up a stone at an endpoint (ie., either the lowest or highest position sto
阅读全文
摘要:Implement the class as follows: : Constructor, init the data structure with the given words. : returns true if and only if for some , the last charact
阅读全文
摘要:Given an array of non negative integers, return the maximum sum of elements in two non overlapping (contiguous) subarrays, which have lengths and . (F
阅读全文
摘要:We are given a matrix with rows and columns has cells with integer coordinates , where `0 这道题给了一个R行C列的矩阵,又给了一个起始点 (r0, c0),让按照离起始点的曼哈顿距离从小到大排序坐标点。博主最先
阅读全文
摘要:A company is planning to interview people. Given the array where , the cost of flying the person to city is , and the cost of flying the person to cit
阅读全文
摘要:Given an array of integers, return the length of the longest arithmetic subsequence in . Recall that a subsequence of is a list with `0 这道题给了一个数组,让找最长
阅读全文
摘要:Given the of a binary tree, find the maximum value for which there exist different nodes and where and is an ancestor of . A node is an ancestor of if
阅读全文
摘要:Alice and Bob take turns playing a game, with Alice starting first. Initially, there is a number on the chalkboard. On each player's turn, that player
阅读全文
摘要:You are given a series of video clips from a sporting event that lasted T seconds. These video clips can be overlapping with each other and have varie
阅读全文
摘要:A query word matches a given if we can insert lowercase letters to the pattern word so that it equals the . (We may insert each character at any posit
阅读全文
摘要:You are given the of a binary tree where each node has a value or . Each root to leaf path represents a binary number starting with the most significa
阅读全文
摘要:A valid parentheses string is either empty , , or , where and are valid parentheses strings, and represents string concatenation. For example, , , , a
阅读全文
摘要:Given a 2D array , each cell is 0 (representing sea) or 1 (representing land) A move consists of walking from one land square 4 directionally to anoth
阅读全文
摘要:We are given a linked list with as the first node. Let's number the nodes in the list: etc. Each node may have a next larger value: for , is the such
阅读全文
摘要:Given an array of s and s, consider : the i th subarray from to interpreted as a binary number (from most significant bit to least significant bit.) R
阅读全文