CNoodle
  • Home
  • Archives
  • Tags
  • About

[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

[LeetCode] 225. Implement Stack using Queues

Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (push, top, pop, and empty). Implement the MyStack class:void
2020-03-04
#leetcode #java #design #stack

[LeetCode] 232. Implement Queue using Stacks

Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (push, peek, pop, and empty). Implement the MyQueue class:vo
2020-03-04
#leetcode #java #javascript #design #stack #queue

[LeetCode] 146. LRU Cache

Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement the LRUCache class: LRUCache(int capacity) Initialize the LRU cache with positive size capacity. i
2020-03-01
#leetcode #java #hashmap #design #linked list

[LeetCode] 977. Squares of a Sorted Array

Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order. Example 1:Input: nums = [-4,-1,0,3,10]Output: [0,1,9,16,1
2020-02-29
#leetcode #java #javascript #array #two pointer

[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 #java #array #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 #java #javascript #array #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 #java #javascript #array #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 #java #javascript #array #matrix #simulation
1…3334353637…41

Search

Hexo Fluid