摘要: 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 阅读(446) 评论(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 阅读(495) 评论(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 阅读(487) 评论(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 阅读(212) 评论(0) 推荐(0)
摘要: Given the root of a binary tree, return the preorder traversal of its nodes' values. Example 1: Input: root = [1,null,2,3] Output: [1,2,3] Example 2: 阅读全文
posted @ 2019-12-16 12:47 CNoodle 阅读(473) 评论(0) 推荐(0)
摘要: Given a string s consisting of words and spaces, return the length of the last word in the string. A word is a maximal substring consisting of non-spa 阅读全文
posted @ 2019-12-10 14:07 CNoodle 阅读(454) 评论(0) 推荐(0)
摘要: Given an integer array nums of length n and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of t 阅读全文
posted @ 2019-11-13 09:08 CNoodle 阅读(480) 评论(0) 推荐(0)
摘要: Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] 阅读全文
posted @ 2019-11-11 13:23 CNoodle 阅读(487) 评论(0) 推荐(0)
摘要: You are given the head of a singly linked-list. The list can be represented as: L0 → L1 → … → Ln - 1 → Ln Reorder the list to be on the following form 阅读全文
posted @ 2019-11-10 14:46 CNoodle 阅读(445) 评论(0) 推荐(0)
摘要: Given the head of a singly linked list, return true if it is a palindrome or false otherwise. Example 1: Input: head = [1,2,2,1] Output: true Example 阅读全文
posted @ 2019-11-10 09:28 CNoodle 阅读(216) 评论(0) 推荐(0)
摘要: You are given the heads of two sorted linked lists list1 and list2. Merge the two lists in a one sorted list. The list should be made by splicing toge 阅读全文
posted @ 2019-11-10 08:01 CNoodle 阅读(646) 评论(0) 推荐(0)
摘要: Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersec 阅读全文
posted @ 2019-11-10 07:54 CNoodle 阅读(222) 评论(0) 推荐(0)
摘要: Given the head of a linked list, return the list after sorting it in ascending order. Follow up: Can you sort the linked list in O(n logn) time and O( 阅读全文
posted @ 2019-11-10 05:54 CNoodle 阅读(567) 评论(0) 推荐(0)
摘要: Given the head of a linked list, return the node where the cycle begins. If there is no cycle, return null. There is a cycle in a linked list if there 阅读全文
posted @ 2019-11-10 05:24 CNoodle 阅读(483) 评论(0) 推荐(0)