随笔分类 - leetcode
https://leetcode.com/problemset/all/
摘要:Some people will make friend requests. The list of their ages is given and ages[i] is the age of the ith person. Person A will NOT friend request pers
阅读全文
摘要:Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between i and j equals
阅读全文
摘要:Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Example 1: Example 2: 很蠢得用了模拟法。。
阅读全文
摘要:Given a list of sorted characters letters containing only lowercase letters, and given a target letter target, find the smallest element in the list t
阅读全文
摘要:Find the sum of all left leaves in a given binary tree.
阅读全文
摘要:You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way. The null node needs to be rep
阅读全文
摘要:Given two arrays, write a function to compute their intersection. Example 1: Example 2: Note: Each element in the result should appear as many times a
阅读全文
摘要:Given a non empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected e
阅读全文
摘要:There are two types of soup: type A and type B. Initially we have N ml of each type of soup. There are four kinds of operations: 1. Serve 100 ml of so
阅读全文
摘要:Write a function to check whether an input string is a valid IPv4 address or IPv6 address or neither. IPv4 addresses are canonically represented in do
阅读全文
摘要:Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum pro
阅读全文
摘要:Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a g
阅读全文
摘要:Design a data structure that supports the following two operations: search(word) can search a literal word or a regular expression string containing o
阅读全文
摘要:Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. The update(i, val) function modifies nums by upd
阅读全文
摘要:Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1. Example 1: Input:
阅读全文
摘要:Given a square array of integers A, we want the minimum sum of a falling path through A. A falling path starts at any element in the first row, and ch
阅读全文
摘要:In a string S of lowercase letters, these letters form consecutive groups of the same character. For example, a string like S = "abbxxxxzyy" has the g
阅读全文
摘要:There are n different online courses numbered from 1 to n. Each course has some duration(course length) t and closed on dth day. A course should be ta
阅读全文
摘要:Given an integer, write a function to determine if it is a power of two. Example 1: Input: 1 Output: true Explanation: 20 = 1 Example 2: Input: 16 Out
阅读全文
摘要:Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrenc
阅读全文

浙公网安备 33010602011771号