摘要:You are given an array of integers `nums`, there is a sliding window of size `k` which is moving from the very left of the array to the very right. Yo
阅读全文
摘要:Given two strings `s` and `p`, return an array of all the start indices of `p`'s anagrams in s. You may return the answer in any order. An Anagram is
阅读全文
摘要:Given a string `s`, find the length of the longest substring without repeating characters. ## Solution 用一个 $dict$ 来映射字符的次数。然后用 $left$, $right$ 来决定wind
阅读全文
摘要:An ugly number is a positive integer that is divisible by $a$, $b$, or $c$. Given four integers $n$, $a$, $b$, and $c$, return the $n$th ugly number.
阅读全文
摘要:Koko loves to eat bananas. There are $n$ piles of bananas, the $i$th pile has $piles[i]$ bananas. The guards have gone and will come back in `h` hours
阅读全文
摘要:A conveyor belt has packages that must be shipped from one port to another within `days` days. The ith package on the conveyor belt has a weight of $w
阅读全文
摘要:An array arr a mountain if the following properties hold: * `arr.length` >= 3 * There exists some i with `0 arr[i + 1] > ... > arr[arr.length - 1] ```
阅读全文
摘要:Let `f(x)` be the number of zeroes at the end of x!. Recall that $x! = 1 * 2 * 3 * ... * x$ and by convention, 0! = 1. For example,` f(3) = 0` because
阅读全文
摘要:Given a sorted integer array `arr`, two integers `k` and `x`, return the `k` closest integers to `x` in the array. The result should also be sorted in
阅读全文
摘要:You are given a 2D array of integers `envelopes` where `envelopes[i] = [wi, hi]` represents the width and the height of an envelope. One envelope can
阅读全文
摘要:There is an `m x n` binary grid matrix with all the values set 0 initially. Design an algorithm to randomly pick an index `(i, j)` where `matrix[i][j]
阅读全文