[LeetCode] 118. Pascal's Triangle Given an integer numRows, return the first numRows of Pascal’s triangle. In Pascal’s triangle, each number is the sum of the two numbers directly above it as shown: Example 1:Input: numRows = 5Ou 2020-05-14 #leetcode #java #array #math
[LeetCode] 987. Vertical Order Traversal of a Binary Tree Given the root of a binary tree, calculate the vertical order traversal of the binary tree. For each node at position (row, col), its left and right children will be at positions (row + 1, col - 1) an 2020-05-13 #leetcode #tree #bfs #java #hashmap
[LeetCode] 314. Binary Tree Vertical Order Traversal Given the root of a binary tree, return the vertical order traversal of its nodes’ values. (i.e., from top to bottom, column by column). If two nodes are in the same row and column, the order should b 2020-05-13 #leetcode #tree #bfs #java #javascript #hashmap
[LeetCode] 1441. Build an Array With Stack Operations You are given an integer array target and an integer n.You have an empty stack with the two following operations:“Push”: pushes an integer to the top of the stack.“Pop”: removes the integer on the top 2020-05-11 #leetcode #java #simulation
[LeetCode] 277. Find the Celebrity Suppose you are at a party with n people labeled from 0 to n - 1 and among them, there may exist one celebrity. The definition of a celebrity is that all the other n - 1 people know the celebrity, but 2020-05-11 #leetcode #java #graph
[LeetCode] 997. Find the Town Judge In a town, there are n people labeled from 1 to n. There is a rumor that one of these people is secretly the town judge. If the town judge exists, then:The town judge trusts nobody.Everybody (except f 2020-05-11 #leetcode #java #hashmap #graph
[LeetCode] 1249. Minimum Remove to Make Valid Parentheses Given a string s of ‘(‘ , ‘)’ and lowercase English characters. Your task is to remove the minimum number of parentheses ( ‘(‘ or ‘)’, in any positions ) so that the resulting parentheses string is va 2020-05-08 #leetcode #java #string #stack
[LeetCode] 84. Largest Rectangle in Histogram Given an array of integers heights representing the histogram’s bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram. Example 1:Input: heights = 2020-05-08 #leetcode #java #javascript #array #stack #monotonic stack
[LeetCode] 993. Cousins in Binary Tree Given the root of a binary tree with unique values and the values of two different nodes of the tree x and y, return true if the nodes corresponding to the values x and y in the tree are cousins, or f 2020-05-08 #leetcode #tree #bfs #dfs #java
[LeetCode] 443. String Compression Given an array of characters chars, compress it using the following algorithm:Begin with an empty string s. For each group of consecutive repeating characters in chars:If the group’s length is 1, appe 2020-05-08 #leetcode #java #two pointer #string #simulation