###### 226. Invert Binary Tree

Problem Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 Output: 4 / \ 7 2 / \ / \ 9 6 3 1 Thought Process Can solve this question recursively. if the root is None, return None else, revert root&rs

Read MorePrimer on Python, Algorithms and Data Structure

Problem Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 Output: 4 / \ 7 2 / \ / \ 9 6 3 1 Thought Process Can solve this question recursively. if the root is None, return None else, revert root&rs

Read MoreProblem Given a binary 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 leaf node. Note: A leaf is a node with no c

Read MoreProblem Given a string containing just the characters ‘(’, ‘)’, ‘{’, ‘}’, ‘[’ and ‘]’, determine if the input string is valid. A

Read MoreProblem Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: NULL<-1<-2<-3<-4<-5 Follow up: A linked list can be reversed either iteratively or rec

Read MoreProblem Given n points in the plane that are all pairwise distinct, a “boomerang” is a tuple of points (i, j, k) such that the distance between i and j equals the distance between i and k

Read MoreProblem Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero. To make problem a bit easier, all A, B, C, D have sam

Read MoreProblem Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use t

Read MoreProblem Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2,2] Example 2: Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4] Out

Read MoreProblem Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2] Example 2: Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4] Outpu

Read MoreProblem Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", with the l

Read More