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 阅读全文
posted @ 2020-12-31 05:52 CNoodle 阅读(137) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-30 01:48 CNoodle 阅读(359) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-28 17:10 CNoodle 阅读(257) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-28 03:21 CNoodle 阅读(723) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-27 16:26 CNoodle 阅读(941) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-26 05:18 CNoodle 阅读(460) 评论(0) 推荐(0)
摘要: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  阅读全文
posted @ 2020-12-26 02:50 CNoodle 阅读(192) 评论(1) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-25 09:51 CNoodle 阅读(314) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-24 03:40 CNoodle 阅读(397) 评论(2) 推荐(0)
摘要:A valid parentheses string is either empty "", "(" + A + ")", or A + B, where A and B are valid parentheses strings, and + represents string concatena 阅读全文
posted @ 2020-12-24 00:55 CNoodle 阅读(127) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-23 04:38 CNoodle 阅读(346) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-23 03:44 CNoodle 阅读(259) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-23 01:19 CNoodle 阅读(281) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-22 15:51 CNoodle 阅读(184) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-18 08:39 CNoodle 阅读(129) 评论(0) 推荐(0)
摘要:Given a parentheses string s containing only the characters '(' and ')'. A parentheses string is balanced if: Any left parenthesis '(' must have a cor 阅读全文
posted @ 2020-12-18 08:10 CNoodle 阅读(566) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-16 06:00 CNoodle 阅读(169) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-15 01:17 CNoodle 阅读(198) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-13 14:30 CNoodle 阅读(256) 评论(0) 推荐(0)
摘要:A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The 阅读全文
posted @ 2020-12-13 10:29 CNoodle 阅读(485) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-13 09:12 CNoodle 阅读(243) 评论(0) 推荐(0)
摘要:Design a stack which supports the following operations. Implement the CustomStack class: CustomStack(int maxSize) Initializes the object with maxSize  阅读全文
posted @ 2020-12-11 14:33 CNoodle 阅读(259) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-10 04:39 CNoodle 阅读(288) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-05 10:36 CNoodle 阅读(511) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-05 07:22 CNoodle 阅读(344) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-05 00:27 CNoodle 阅读(227) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-04 11:52 CNoodle 阅读(218) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-04 01:07 CNoodle 阅读(111) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-03 06:50 CNoodle 阅读(250) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-03 02:10 CNoodle 阅读(86) 评论(0) 推荐(0)
摘要: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, 阅读全文
posted @ 2020-12-02 02:52 CNoodle 阅读(271) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-12-02 02:23 CNoodle 阅读(78) 评论(0) 推荐(0)