01 2020 档案

摘要:Given the root of a binary tree, determine if it is a valid binary search tree (BST). A valid BST is defined as follows: The left subtree of a node co 阅读全文
posted @ 2020-01-31 03:03 CNoodle 阅读(486) 评论(0) 推荐(0)
摘要:Given the root node of a binary search tree and two integers low and high, return the sum of values of all nodes with a value in the inclusive range [ 阅读全文
posted @ 2020-01-30 03:19 CNoodle 阅读(218) 评论(0) 推荐(0)
摘要:Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, 2 is 阅读全文
posted @ 2020-01-29 03:08 CNoodle 阅读(507) 评论(0) 推荐(0)
摘要:Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, 2 is 阅读全文
posted @ 2020-01-29 02:05 CNoodle 阅读(481) 评论(0) 推荐(0)
摘要:You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list 阅读全文
posted @ 2020-01-29 00:55 CNoodle 阅读(519) 评论(0) 推荐(0)
摘要:Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume t 阅读全文
posted @ 2020-01-28 01:54 CNoodle 阅读(158) 评论(0) 推荐(0)
摘要:Given an array of strings strs, group the anagrams together. You can return the answer in any order. An Anagram is a word or phrase formed by rearrang 阅读全文
posted @ 2020-01-24 02:35 CNoodle 阅读(509) 评论(0) 推荐(0)
摘要:Given a string s, sort it in decreasing order based on the frequency of characters, and return the sorted string. Example 1: Input: s = "tree" Output: 阅读全文
posted @ 2020-01-23 13:07 CNoodle 阅读(244) 评论(0) 推荐(0)
摘要:The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding one 阅读全文
posted @ 2020-01-22 05:51 CNoodle 阅读(133) 评论(0) 推荐(0)
摘要:You are given two binary trees root1 and root2. Imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped w 阅读全文
posted @ 2020-01-21 02:45 CNoodle 阅读(179) 评论(0) 推荐(0)
摘要:Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there ar 阅读全文
posted @ 2020-01-21 01:38 CNoodle 阅读(143) 评论(0) 推荐(0)
摘要:A linked list of length n is given such that each node contains an additional random pointer, which could point to any node in the list, or null. Cons 阅读全文
posted @ 2020-01-18 08:09 CNoodle 阅读(526) 评论(0) 推荐(0)
摘要:Given an integer x, return true if x is a palindrome, and false otherwise. Example 1: Input: x = 121 Output: true Explanation: 121 reads as 121 from l 阅读全文
posted @ 2020-01-16 13:51 CNoodle 阅读(445) 评论(0) 推荐(0)
摘要:A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the 阅读全文
posted @ 2020-01-15 03:37 CNoodle 阅读(454) 评论(0) 推荐(0)
摘要:Given the root of an n-ary tree, return the preorder traversal of its nodes' values. Nary-Tree input serialization is represented in their level order 阅读全文
posted @ 2020-01-15 01:16 CNoodle 阅读(166) 评论(0) 推荐(0)
摘要:Given a n-ary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest le 阅读全文
posted @ 2020-01-14 14:40 CNoodle 阅读(151) 评论(0) 推荐(0)
摘要:You are given an integer array score of size n, where score[i] is the score of the ith athlete in a competition. All the scores are guaranteed to be u 阅读全文
posted @ 2020-01-14 02:39 CNoodle 阅读(252) 评论(0) 推荐(0)
摘要:Given the root of a binary tree, return the leftmost value in the last row of the tree. Example 1: Input: root = [2,1,3] Output: 1 Example 2: Input: r 阅读全文
posted @ 2020-01-14 01:44 CNoodle 阅读(175) 评论(0) 推荐(0)
摘要:Given the root of a binary tree, return the length of the longest consecutive sequence path. The path refers to any sequence of nodes from some starti 阅读全文
posted @ 2020-01-13 13:28 CNoodle 阅读(229) 评论(0) 推荐(0)
摘要:Given the root of a binary tree and an integer targetSum, return all root-to-leaf paths where the sum of the node values in the path equals targetSum. 阅读全文
posted @ 2020-01-12 14:27 CNoodle 阅读(472) 评论(0) 推荐(0)
摘要:Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the 阅读全文
posted @ 2020-01-12 13:26 CNoodle 阅读(490) 评论(0) 推荐(0)
摘要:Given a binary tree, return all root-to-leaf paths. Note: A leaf is a node with no children. Example: Input: 1 / \ 2 3 \ 5 Output: ["1->2->5", "1->3"] 阅读全文
posted @ 2020-01-12 11:56 CNoodle 阅读(189) 评论(0) 推荐(0)
摘要:Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level). Example 1: Input: 阅读全文
posted @ 2020-01-12 07:35 CNoodle 阅读(465) 评论(0) 推荐(0)
摘要:Given the root of a binary tree, return the postorder traversal of its nodes' values. Example 1: Input: root = [1,null,2,3] Output: [3,2,1] Example 2: 阅读全文
posted @ 2020-01-10 03:48 CNoodle 阅读(448) 评论(0) 推荐(0)
摘要:Given the root of a binary tree, return the inorder traversal of its nodes' values. Example 1: Input: root = [1,null,2,3] Output: [1,3,2] Example 2: I 阅读全文
posted @ 2020-01-10 02:41 CNoodle 阅读(544) 评论(0) 推荐(0)
摘要:Given the root of a binary tree, invert the tree, and return its root. Example 1: Input: root = [4,2,7,1,3,6,9] Output: [4,7,2,9,6,3,1] Example 2: Inp 阅读全文
posted @ 2020-01-08 02:37 CNoodle 阅读(239) 评论(0) 推荐(0)
摘要:Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center). Example 1: Input: root = [1,2,2,3,4,4,3] 阅读全文
posted @ 2020-01-08 01:30 CNoodle 阅读(424) 评论(0) 推荐(0)
摘要:Given the roots of two binary trees p and q, write a function to check if they are the same or not. Two binary trees are considered the same if they a 阅读全文
posted @ 2020-01-07 03:36 CNoodle 阅读(496) 评论(0) 推荐(0)
摘要:Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest path from the root n 阅读全文
posted @ 2020-01-07 02:55 CNoodle 阅读(470) 评论(0) 推荐(0)
摘要:Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3].... Example: Input: nums = [3,5,2,1,6,4] Output: 阅读全文
posted @ 2020-01-07 02:36 CNoodle 阅读(141) 评论(0) 推荐(0)
摘要:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining. Exampl 阅读全文
posted @ 2020-01-06 14:41 CNoodle 阅读(489) 评论(0) 推荐(0)
摘要:Reverse bits of a given 32 bits unsigned integer. Note: Note that in some languages, such as Java, there is no unsigned integer type. In this case, bo 阅读全文
posted @ 2020-01-06 07:02 CNoodle 阅读(213) 评论(0) 推荐(0)