CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 84. Largest Rectangle in Histogram

Given an array of integers heights representing the histogram’s bar height where the width of each bar is 1, return the area of the largest rectangle in the histogram. Example 1:Input: heights =
2020-05-08
#leetcode #java #javascript #array #stack #monotonic stack

[LeetCode] 993. Cousins in Binary Tree

Given the root of a binary tree with unique values and the values of two different nodes of the tree x and y, return true if the nodes corresponding to the values x and y in the tree are cousins, or f
2020-05-08
#leetcode #tree #bfs #dfs #java

[LeetCode] 443. String Compression

Given an array of characters chars, compress it using the following algorithm:Begin with an empty string s. For each group of consecutive repeating characters in chars:If the group’s length is 1, appe
2020-05-08
#leetcode #java #two pointer #string #simulation

[LeetCode] 286. Walls and Gates

You are given an m x n grid rooms initialized with these three possible values. -1 A wall or an obstacle.0 A gate.INF Infinity means an empty room. We use the value 231 - 1 = 2147483647 to repres
2020-05-02
#leetcode #bfs #java #array #flood fill

[LeetCode] 130. Surrounded Regions

You are given an m x n matrix board containing letters ‘X’ and ‘O’, capture regions that are surrounded: Connect: A cell is connected to adjacent cells horizontally or vertically.Region: To form a reg
2020-05-02
#leetcode #bfs #dfs #java #array #matrix

[LeetCode] 1095. Find in Mountain Array

(This problem is an interactive problem.) You may recall that an array arr is a mountain array if and only if: arr.length >= 3There exists some i with 0 < i < arr.length - 1 such that:ar
2020-04-29
#leetcode #java #array #binary search

[LeetCode] 704. Binary Search

Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1. You
2020-04-29
#leetcode #java #javascript #binary search

[LeetCode] 221. Maximal Square

Given an m x n binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area. Example 1: Input: matrix = [[“1”,”0”,”1”,”0”,”0”],[“1”,”0”,”1”,”1”,”1”],[“1”
2020-04-28
#leetcode #java #dynamic programming #matrix

[LeetCode] 621. Task Scheduler

You are given an array of CPU tasks, each represented by letters A to Z, and a cooling time, n. Each cycle or interval allows the completion of one task. Tasks can be completed in any order, but there
2020-04-26
#leetcode #java #hashmap #greedy #heap

[LeetCode] 18. 4Sum

Given an array nums of n integers, return an array of all the unique quadruplets [nums[a], nums[b], nums[c], nums[d]] such that:0 <= a, b, c, d < na, b, c, and d are distinct.nums[a] + nums
2020-04-26
#leetcode #java #javascript #array #two sum #two pointer
1…3233343536…47

Search

Hexo Fluid