[LeetCode] 739. Daily Temperatures Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the ith day to get a warmer temperatu 2020-03-15 #leetcode #array #java #javascript #stack #monotonic stack
[LeetCode] 6. Zigzag Conversion The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H NA P L S I I GY 2020-03-14 #leetcode #java #string
[LeetCode] 572. Subtree of Another Tree Given the roots of two binary trees root and subRoot, return true if there is a subtree of root with the same structure and node values of subRoot and false otherwise. A subtree of a binary tree tree 2020-03-12 #leetcode #java #javascript #tree #dfs #recursion
[LeetCode] 450. Delete Node in a BST Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST. Basically, the deletion can be divided into 2020-03-12 #leetcode #java #tree #recursion #bst
[LeetCode] 1122. Relative Sort Array Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1. Sort the elements of arr1 such that the relative ordering of items in arr1 are the same as 2020-03-11 #leetcode #array #java #javascript #counting sort
[LeetCode] 236. Lowest Common Ancestor of a Binary Tree Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p a 2020-03-10 #leetcode #java #javascript #tree #dfs #recursion
[LeetCode] 235. Lowest Common Ancestor of a Binary Search Tree Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between t 2020-03-10 #leetcode #java #javascript #tree #recursion #bst
[LeetCode] 295. Find Median from Data Stream The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two middle values. For example, for arr = [ 2020-03-10 #leetcode #java #design #heap
[LeetCode] 347. Top K Frequent Elements Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order. Example 1:Input: nums = [1,1,1,2,2,3], k = 2Output: [1,2] Example 2 2020-03-08 #leetcode #array #hashmap #java #bucket sort #heap
[LeetCode] 41. First Missing Positive Given an unsorted integer array nums. Return the smallest positive integer that is not present in nums. You must implement an algorithm that runs in O(n) time and uses O(1) auxiliary space. Example 1: 2020-03-06 #leetcode #array #java #javascript #bucket sort