[LeetCode] 94. Binary Tree Inorder Traversal 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:Input: root = []Output: [] Example 3:Input: 2020-01-10 #leetcode #java #tree #dfs #inorder
[LeetCode] 226. Invert Binary Tree 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:Input: root = [2,1,3]Output: [2,3,1] Example 3 2020-01-08 #leetcode #java #tree #bfs #dfs #preorder
[LeetCode] 100. Same Tree 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 are structurally identical, and the nodes have the 2020-01-07 #leetcode #java #javascript #tree #bfs #dfs
[LeetCode] 104. Maximum Depth of Binary Tree 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 node down to the farthest leaf node. Example 1:Inpu 2020-01-07 #leetcode #java #tree #dfs #postorder
[LeetCode] 42. Trapping Rain Water 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. Example 1:Input: height = [0,1,0,2,1,0,1,3,2,1,2,1] 2020-01-06 #leetcode #array #two pointer #java #javascript #stack #monotonic stack
[LeetCode] 144. Binary Tree Preorder Traversal 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:Input: root = []Output: [] Example 3:Input: 2019-12-16 #leetcode #java #tree #dfs #preorder
[Leetcode] 58. Length of Last Word 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-space characters only. Example 1:Input: s = “Hel 2019-12-10 #leetcode #java #javascript #string
[LeetCode] 16. 3Sum Closest 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 the three integers. You may assume that each input 2019-11-13 #leetcode #array #two pointer #java #javascript #two sum
[LeetCode] 143. Reorder List 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:L0 → Ln → L1 → Ln - 1 → L2 → Ln - 2 → …You may not 2019-11-10 #leetcode #two pointer #java #javascript #linked list
[LeetCode] 21. Merge Two Sorted Lists You are given the heads of two sorted linked lists list1 and list2. Merge the two lists into one sorted list. The list should be made by splicing together the nodes of the first two lists. Return the 2019-11-10 #leetcode #java #javascript #sort #linked list #merge sort