[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 #tree #dfs #java #javascript #recursion
[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 #java #javascript #array #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 #tree #dfs #java #javascript #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 #tree #java #javascript #recursion #bst
[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 #java #array #hashmap #bucket sort #heap
[LeetCode] 31. Next Permutation A permutation of an array of integers is an arrangement of its members into a sequence or linear order. For example, for arr = [1,2,3], the following are all the permutations of arr: [1,2,3], [1, 2020-03-05 #leetcode #java #javascript #array #permutation
[LeetCode] 45. Jump Game II Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your goal is to r 2020-03-05 #leetcode #java #javascript #array #dynamic programming #greedy
[LeetCode] 55. Jump Game Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you 2020-03-04 #leetcode #java #javascript #array #dynamic programming #greedy
[LeetCode] 452. Minimum Number of Arrows to Burst Balloons There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since it’s horizontal, y-coordin 2020-03-04 #leetcode #java #array #greedy #sort