随笔分类 - LeetCode
摘要:Given an array of strings products and a string searchWord. We want to design a system that suggests at most three product names from products after e
阅读全文
摘要:On a 2D plane, there are n points with integer coordinates points[i] = [xi, yi]. Return *the minimum time in seconds to visit all the points in the or
阅读全文
摘要:A storekeeper is a game in which the player pushes boxes around in a warehouse trying to get them to target locations. The game is represented by an m
阅读全文
摘要:Given an array nums of integers, we need to find the maximum possible sum of elements of the array such that it is divisible by three. Example 1: Inpu
阅读全文
摘要:Given a binary tree with the following rules: root.val == 0 If treeNode.val == x and treeNode.left != null, then treeNode.left.val == 2 * x + 1 If tre
阅读全文
摘要:Given a 2D grid of size m x n and an integer k. You need to shift the grid k times. In one shift operation: Element at grid[i][j] moves to grid[i][j +
阅读全文
摘要:Given a list of words, list of single letters (might be repeating) and score of every character. Return the maximum score of any valid set of words fo
阅读全文
摘要:Given a 2D grid consists of 0s (land) and 1s (water). An island is a maximal 4-directionally connected group of 0s and a closed island is an island to
阅读全文
摘要:Given the following details of a matrix with n columns and 2 rows : The matrix is a binary matrix, which means each element in the matrix can be 0 or
阅读全文
摘要:There is an m x n matrix that is initialized to all 0's. There is also a 2D array indices where each indices[i] = [ri, ci] represents a 0-indexed loca
阅读全文
摘要:Given an array nums of positive integers. Your task is to select some subset of nums, multiply each element by an integer and add all these numbers. T
阅读全文
摘要:Given a string s of '(' , ')' and lowercase English characters. Your task is to remove the minimum number of parentheses ( '(' or ')', in any position
阅读全文
摘要:Given an array of integers nums and an integer k. A continuous subarray is called nice if there are k odd numbers on it. Return the number of nice sub
阅读全文
摘要:You are given two strings s1 and s2 of equal length consisting of letters "x" and "y" only. Your task is to make these two strings equal to each other
阅读全文
摘要:Given a rectangle of size n x m, return the minimum number of integer-sided squares that tile the rectangle. Example 1: Input: n = 2, m = 3 Output: 3
阅读全文
摘要:You are given an array of strings arr. A string s is formed by the concatenation of a subsequence of arr that has unique characters. Return the maximu
阅读全文
摘要:Given 2 integers n and start. Your task is return any permutation p of (0,1,2.....,2^n -1) such that : p[0] = start p[i] and p[i+1] differ by only one
阅读全文
摘要:Given a callable function f(x, y) with a hidden formula and a value z, reverse engineer the formula and return *all positive integer pairs x and y whe
阅读全文
摘要:We have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i]. You're given the startTime,
阅读全文
摘要:You are given a string containing only 4 kinds of characters 'Q', 'W', 'E' and 'R'. A string is said to be balancedif each of its characters appears n
阅读全文