[LeetCode] 498. Diagonal Traverse Given an m x n matrix mat, return an array of all the elements of the array in a diagonal order. Example 1:Input: mat = [[1,2,3],[4,5,6],[7,8,9]]Output: [1,2,4,7,5,3,6,8,9] Example 2:Input: mat & 2020-02-29 #leetcode #array #java #matrix
[LeetCode] 73. Set Matrix Zeroes Given an m x n integer matrix matrix, if an element is 0, set its entire row and column to 0’s. You must do it in place. Example 1:Input: matrix = [[1,1,1],[1,0,1],[1,1,1]]Output: [[1,0,1],[0,0,0 2020-02-14 #leetcode #array #java #javascript #matrix
[LeetCode] 59. Spiral Matrix II Given a positive integer n, generate an n x n matrix filled with elements from 1 to n2 in spiral order. Example 1:Input: n = 3Output: [[1,2,3],[8,9,4],[7,6,5]] Example 2:Input: n = 1Output: 2020-02-14 #leetcode #array #java #javascript #matrix
[LeetCode] 54. Spiral Matrix Given an m x n matrix, return all elements of the matrix in spiral order. Example 1:Input: matrix = [[1,2,3],[4,5,6],[7,8,9]]Output: [1,2,3,6,9,8,7,4,5] Example 2:Input: matrix = [[1,2,3,4], 2020-02-14 #leetcode #array #java #javascript #matrix #simulation
[LeetCode] 48. Rotate Image You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. 2020-02-14 #leetcode #array #java #javascript #matrix
[LeetCode] 134. Gas Station There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from the ith stat 2020-02-13 #leetcode #array #java #javascript #greedy #math
[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 #java #tree #bfs
[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 #java #javascript #tree #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 #java #tree #recursion #bst