LeetCode –Binary Tree Postorder Traversal
Given a binary tree, return the _postorder_ traversal of its nodes' values. Example: Input: [1,null,2,3] \\ / Output: [3,2,1] Follow up: Recursive solution…
Given a binary tree, return the _postorder_ traversal of its nodes' values. Example: Input: [1,null,2,3] \\ / Output: [3,2,1] Follow up: Recursive solution…
Given a binary tree, return the _inorder_ traversal of its nodes' values. Example: Input: Output: Follow up: Recursive solution is trivial, could you do it…
There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, ..., N-1, and each room may have some keys to access the next room.…
LeetCode – Matrix - Given a matrix consists of and 1, find the distance of the nearest for each cell
An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from to 65535). Given a coordinate (sr, sc) …
Given an encoded string, return its decoded string
Implement the following operations of a stack using queues. - push(x) -- Push element x onto stack. - pop() -- Removes the element on top of the stack. - top()…
Implement the following operations of a queue using stacks. - push(x) -- Push element x to the back of queue. - pop() -- Removes the element from in front of…
Given a binary tree, return the _inorder_ traversal of its nodes\\' values. Example: Input: Output: Follow up: Recursive solution is trivial, could you do it…
You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have symbols + and -. For each integer, you should choose one from + …