[LeetCode] 70. Climbing Stairs You are climbing a staircase. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Note: Given n will be a positive in 2020-02-13 #leetcode #java #dynamic programming #math #memoization
[LeetCode] 107. Binary Tree Level Order Traversal II Given the root of a binary tree, return the bottom-up level order traversal of its nodes’ values. (i.e., from left to right, level by level from leaf to root). Example 1:Input: root = [3,9,20,nul 2020-02-11 #leetcode #tree #bfs #java
[LeetCode] 98. Validate Binary Search Tree Given the root of a binary tree, determine if it is a valid binary search tree (BST). A valid BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node’s ke 2020-01-31 #leetcode #tree #java #javascript #inorder #bst
938. Range Sum of BST Given the root node of a binary search tree and two integers low and high, return the sum of values of all nodes with a value in the inclusive range [low, high]. Example 1:Input: root = [10,5,15, 2020-01-30 #leetcode #tree #java #recursion #bst
[LeetCode] 169. Majority Element Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the 2020-01-28 #leetcode #java #javascript #array #hashmap #math
[LeetCode] 49. Group Anagrams Given an array of strings strs, group the anagrams together. You can return the answer in any order. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typ 2020-01-24 #leetcode #java #javascript #array #hashmap #counting sort
[LeetCode] 451. Sort Characters By Frequency Given a string s, sort it in decreasing order based on the frequency of characters, and return the sorted string. Example 1:Input: s = “tree”Output: “eert”Explanation: ‘e’ appears twice while ‘r’ 2020-01-23 #leetcode #java #hashmap #sort #bucket sort #string #heap
[LeetCode] 138. Copy List with Random Pointer A linked list of length n is given such that each node contains an additional random pointer, which could point to any node in the list, or null. Construct a deep copy of the list. The deep copy shoul 2020-01-18 #leetcode #java #javascript #hashmap #linked list
[LeetCode] 9. Palindrome Number Given an integer x, return true if x is a palindrome, and false otherwise. Example 1:Input: x = 121Output: trueExplanation: 121 reads as 121 from left to right and from right to left. Example 2:I 2020-01-16 #leetcode #java #javascript #two pointer #math #palindrome
[LeetCode] 589. N-ary Tree Preorder Traversal Given the root of an n-ary tree, return the preorder traversal of its nodes’ values. Nary-Tree input serialization is represented in their level order traversal. Each group of children is separated by 2020-01-15 #leetcode #tree #dfs #java #preorder #n-ary tree