CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 1277. Count Square Submatrices with All Ones

Given a m * n matrix of ones and zeros, return how many square submatrices have all ones. Example 1:Input: matrix =[ [0,1,1,1], [1,1,1,1], [0,1,1,1]]Output: 15Explanation:There are 10 squares
2020-05-22
#leetcode #java #dynamic programming #matrix

[LeetCode] 901. Online Stock Span

Design an algorithm that collects daily price quotes for some stock and returns the span of that stock’s price for the current day. The span of the stock’s price in one day is the maximum number of co
2020-05-20
#leetcode #java #stack #design #monotonic stack

[LeetCode] 1371. Find the Longest Substring Containing Vowels in Even Counts

Given the string s, return the size of the longest substring containing each vowel an even number of times. That is, ‘a’, ‘e’, ‘i’, ‘o’, and ‘u’ must appear an even number of times. Example 1:Input: s
2020-05-20
#leetcode #java #prefix sum #string #bit manipulation

[LeetCode] 567. Permutation in String

Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise. In other words, return true if one of s1’s permutations is the substring of s2. Example 1:Input: s1 &#x
2020-05-19
#leetcode #java #hashmap #two pointer #sliding window #string

[LeetCode] 152. Maximum Product Subarray

Given an integer array nums, find a subarray that has the largest product, and return the product. The test cases are generated so that the answer will fit in a 32-bit integer. Example 1:Input: nums &
2020-05-18
#leetcode #java #array #dynamic programming

[LeetCode] 227. Basic Calculator II

Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division should
2020-05-17
#leetcode #java #math #string #stack

[LeetCode] 224. Basic Calculator

Implement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and closing parentheses ), the plus + or minus sign -, non-negative integers and empty spa
2020-05-17
#leetcode #java #math #string #stack

[LeetCode] 981. Time Based Key-Value Store

Design a time-based key-value data structure that can store multiple values for the same key at different time stamps and retrieve the key’s value at a certain timestamp. Implement the TimeMap class:
2020-05-16
#leetcode #java #hashmap #treemap #string #binary search #design

[LeetCode] 85. Maximal Rectangle

Given a rows x cols binary matrix filled with 0’s and 1’s, find the largest rectangle containing only 1’s and return its area. Example 1:Input: matrix = [ [“1”,”0”,”1”,”0”,”0”], [“1”,”0”,”1”,”1”,
2020-05-15
#leetcode #java #javascript #array #stack #monotonic stack

[LeetCode] 119. Pascal's Triangle II

Given an integer rowIndex, return the rowIndexth (0-indexed) row of the Pascal’s triangle. In Pascal’s triangle, each number is the sum of the two numbers directly above it as shown: Example 1:Input:
2020-05-14
#leetcode #java #array #math
1…3031323334…47

Search

Hexo Fluid