CNoodle
  • Home
  • Archives
  • Tags
  • About

[LeetCode] 787. Cheapest Flights Within K Stops

There are n cities connected by some number of flights. You are given an array flights where flights[i] = [fromi, toi, pricei] indicates that there is a flight from city fromi to city toi with co
2020-06-15
#leetcode #java #bfs #graph #dijkstra #heap

[LeetCode] 392. Is Subsequence

Given two strings s and t, return true if s is a subsequence of t, or false otherwise. A subsequence of a string is a new string that is formed from the original string by deleting some (can be none)
2020-06-10
#leetcode #two pointer #java #dynamic programming #greedy #binary search

[LeetCode] 886. Possible Bipartition

We want to split a group of n people (labeled from 1 to n) into two groups of any size. Each person may dislike some other people, and they should not go into the same group. Given the integer n and t
2020-05-28
#leetcode #java #bfs #dfs #graph

[LeetCode] 259. 3Sum Smaller

Given an array of n integers nums and an integer target, find the number of index triplets i, j, k with 0 <= i < j < k < n that satisfy the condition nums[i] + nums[j] + nums[k] <
2020-05-28
#leetcode #array #two pointer #java #sort

[LeetCode] 394. Decode String

Given an encoded string, return its decoded string. The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is guara
2020-05-28
#leetcode #java #recursion #string #stack #javacript

[LeetCode] 91. Decode Ways

You have intercepted a secret message encoded as a string of numbers. The message is decoded via the following mapping: “1” -> ‘A’“2” -> ‘B’… “25” -> ‘Y’“26” -> ‘Z’ However, while decoding
2020-05-23
#leetcode #java #javascript #dynamic programming #string

[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 #two pointer #hashmap #java #sliding window #string
1…2829303132…44

Search

Hexo Fluid