leetcode
leetcode copied to clipboard
Provide all my solutions and explanations in Chinese for all the Leetcode coding problems.
Given the coordinates of four points in 2D space, return whether the four points could construct a square. The coordinate (x,y) of a point is represented by an integer array...
Given a string `s`, partition `s` such that every substring of the partition is a palindrome. Return _the minimum cuts needed_ for a palindrome partitioning of `s`. Example 1: Input:...
Given an array of strings `words` (without duplicates), return _all the concatenated words in the given list of_ `words`. A concatenated word is defined as a string that is comprised...
Some people will make friend requests. The list of their ages is given and `ages[i]` is the age of the ith person. Person A will NOT friend request person B...
Given a list of sorted characters `letters` containing only lowercase letters, and given a target letter `target`, find the smallest element in the list that is larger than the given...
请问 dp[0] = 1 要怎么理解? 虽然从结果来倒推回去, 需要dp[0] 为1, 但是含义还是无法想清楚 _Originally posted by @ericuni in https://github.com/grandyang/leetcode/issues/377#issuecomment-537517833_
The while condition should add carry != 0, like this: while( l1 != null || l2 != null || carry ==1){ } otherwise, it cannot pass the test case like:...
Given an `n x n` `matrix` where each of the rows and columns is sorted in ascending order, return _the_ `kth` _smallest element in the matrix_. Note that it is...
Nearly every one have used the [Multiplication Table](https://en.wikipedia.org/wiki/Multiplication_table). But could you find out the `k-th` smallest number quickly from the multiplication table? Given the height `m` and the length `n` ...
On a horizontal number line, we have gas stations at positions `stations[0], stations[1], ..., stations[N-1]`, where `N = stations.length`. Now, we add `K` more gas stations so that D, the...