12 2020 档案
摘要:You are standing at position 0 on an infinite number line. There is a goal at position target. On each move, you can either go left or right. During t
阅读全文
摘要:Given a binary tree where node values are digits from 1 to 9. A path in the binary tree is said to be pseudo-palindromic if at least one permutation o
阅读全文
摘要:Implement the class ProductOfNumbers that supports two methods: 1. add(int num) Adds the number num to the back of the current list of numbers. 2. get
阅读全文
摘要:You have a graph of n nodes labeled from 0 to n - 1. You are given an integer n and a list of edges where edges[i] = [ai, bi] indicates that there is
阅读全文
摘要:You have a graph of n nodes. You are given an integer n and an array edges where edges[i] = [ai, bi] indicates that there is an edge between ai and bi
阅读全文
摘要:You are given two arrays rowSum and colSum of non-negative integers where rowSum[i] is the sum of the elements in the ith row and colSum[j] is the sum
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:Given a string s consisting only of characters a, b and c. Return the number of substrings containing at least one occurrence of all these characters
阅读全文
摘要:A valid parentheses string is either empty "", "(" + A + ")", or A + B, where A and B are valid parentheses strings, and + represents string concatena
阅读全文
摘要:Given an array of integers nums, you start with an initial positive value startValue. In each iteration, you calculate the step by step sum of startVa
阅读全文
摘要:Given the root of a binary tree and a node u in the tree, return the nearest node on the same level that is to the right of u, or return null if u is
阅读全文
摘要:An encoded string S is given. To find and write the decoded string to a tape, the encoded string is read one character at a time and the following ste
阅读全文
摘要:You are given an m x n binary matrix grid, where 0 represents a sea cell and 1 represents a land cell. A move consists of walking from one land cell t
阅读全文
摘要:A parentheses string is valid if and only if: It is the empty string, It can be written as AB (A concatenated with B), where A and B are valid strings
阅读全文
摘要:Given a parentheses string s containing only the characters '(' and ')'. A parentheses string is balanced if: Any left parenthesis '(' must have a cor
阅读全文
摘要:Given a non-negative integer N, find the largest number that is less than or equal to N with monotone increasing digits. (Recall that an integer has m
阅读全文
摘要:You are given two linked lists: list1 and list2 of sizes n and m respectively. Remove list1's nodes from the ath node to the bth node, and put list2 i
阅读全文
摘要:Given the root of a binary tree, the depth of each node is the shortest distance to the root. Return the smallest subtree such that it contains all th
阅读全文
摘要:A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The
阅读全文
摘要:Let's define a function f(s) over a non-empty string s, which calculates the frequency of the smallest character in s. For example, if s = "dcce" then
阅读全文
摘要:Design a stack which supports the following operations. Implement the CustomStack class: CustomStack(int maxSize) Initializes the object with maxSize
阅读全文
摘要:A binary tree is named Even-Odd if it meets the following conditions: The root of the binary tree is at level index 0, its children are at level index
阅读全文
摘要:You have a binary tree with a small defect. There is exactly one invalid node where its right child incorrectly points to another node at the same dep
阅读全文
摘要:Given two positive integers n and k. A factor of an integer n is defined as an integer i where n % i == 0. Consider a list of all factors of n sorted
阅读全文
摘要:Given a binary tree where every node has a unique value, and a target key k, find the value of the nearest leaf node to target k in the tree. Here, ne
阅读全文
摘要:Given an array nums sorted in ascending order, return true if and only if you can split it into 1 or more subsequences such that each subsequence cons
阅读全文
摘要:Given the root of a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every no
阅读全文
摘要:Convert a Binary Search Tree to a sorted Circular Doubly-Linked List in place. You can think of the left and right pointers as synonymous to the prede
阅读全文
摘要:Given a singly linked list, return a random node's value from the linked list. Each node must have the same probability of being chosen. Follow up:Wha
阅读全文
摘要:Given a binary tree root and an integer target, delete all the leaf nodes with value target. Note that once you delete a leaf node with value target,
阅读全文
摘要:We are given the head node root of a binary tree, where additionally every node's value is either a 0 or a 1. Return the same tree where every subtree
阅读全文

浙公网安备 33010602011771号