You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -235,6 +235,8 @@
235
235
|286|[Walls and Gates](https://leetcode.com/problems/walls-and-gates/)|[Java](https://github.com/dingjikerbo/leetcode/blob/master/solution/src/main/java/com/inuker/solution/WallsAndGates.java)|70|多看两遍|
236
236
|287|[Find the Duplicate Number](https://leetcode.com/problems/find-the-duplicate-number/)|[Java](https://github.com/dingjikerbo/leetcode/blob/master/solution/src/main/java/com/inuker/solution/FindTheDuplicateNumber.java)||
237
237
|288|[Unique Word Abbreviation](https://leetcode.com/problems/unique-word-abbreviation/)|[Java](https://github.com/dingjikerbo/leetcode/blob/master/solution/src/main/java/com/inuker/solution/ValidWordAbbr.java)|70|这题不难,多做两遍,题目意思容易理解错|
|294|[Flip Game II](https://leetcode.com/problems/flip-game-ii/)|[Java](https://github.com/dingjikerbo/leetcode/blob/master/solution/src/main/java/com/inuker/solution/FlipGameII.java)|90||
238
240
|295|[Find Median from Data Stream](https://leetcode.com/problems/find-median-from-data-stream/)|[Java](https://github.com/dingjikerbo/leetcode/blob/master/solution/src/main/java/com/inuker/solution/FindMedianFromDataStream.java)||
239
241
|297|[Serialize and Deserialize Binary Tree](https://leetcode.com/problems/serialize-and-deserialize-binary-tree/)|[Java](https://github.com/dingjikerbo/leetcode/blob/master/solution/src/main/java/com/inuker/solution/Codec.java)|80|好题目,多做做,递归的非递归的|
240
242
|298|[Binary Tree Longest Consecutive Sequence](https://leetcode.com/problems/binary-tree-longest-consecutive-sequence/)|[Java](https://github.com/dingjikerbo/leetcode/blob/master/solution/src/main/java/com/inuker/solution/BinaryTreeLongestConsecutiveSequence.java)|70|多做三遍,尽可能简洁|
@@ -271,6 +273,7 @@
271
273
|345|[Reverse Vowels of a String](https://leetcode.com/problems/reverse-vowels-of-a-string/)|[Java](https://github.com/dingjikerbo/leetcode/blob/master/solution/src/main/java/com/inuker/solution/ReverseVowelsOfaString.java)|100||
272
274
|346|[Moving Average from Data Stream](https://leetcode.com/problems/moving-average-from-data-stream/)|[Java](https://github.com/dingjikerbo/leetcode/blob/master/solution/src/main/java/com/inuker/solution/MovingAverage.java)|95|
273
275
|347|[Top K Frequent Elements](https://leetcode.com/problems/top-k-frequent-elements/)|[Java](https://github.com/dingjikerbo/leetcode/blob/master/solution/src/main/java/com/inuker/solution/TopKFrequentElements.java)|85|
|357|[Count Numbers with Unique Digits](https://leetcode.com/problems/count-numbers-with-unique-digits/)|[Java](https://github.com/dingjikerbo/leetcode/blob/master/solution/src/main/java/com/inuker/solution/CountNumberWithUniqueDigits.java)||
275
278
|358|[Rearrange String k Distance Apart](https://leetcode.com/problems/rearrange-string-k-distance-apart/)|[Java](https://github.com/dingjikerbo/leetcode/blob/master/solution/src/main/java/com/inuker/solution/RearrangeStringKDistanceApart.java)||
Given two integers n and k, you need to construct a list which contains n different positive integers ranging from 1 to n and obeys the following requirement:
2302
-
2303
-
Suppose this list is \code{[a1, a2, a3, ... , an]}, then the list \code{[|a1 - a2|, |a2 - a3|, |a3 - a4|, ... , |an-1 - an|]} has exactly k distinct integers.
2304
-
2305
-
If there are multiple answers, print any of them.
2306
-
2307
-
\textbf{Example 1:}
2308
-
2309
-
\textbf{Input:} n = 3, k = 1
2310
-
2311
-
\textbf{Output:} \code{[1, 2, 3]}
2312
-
2313
-
\textbf{Explanation:}The \code{[1, 2, 3]} has three different positive integers ranging from 1 to 3, and the \code{[1, 1]} has exactly 1 distinct integer: 1.
2314
-
2315
-
\textbf{Example 2:}
2316
-
2317
-
\textbf{Input:} n = 3, k = 2
2318
-
2319
-
\textbf{Output:} \code{[1, 3, 2]}
2320
-
2321
-
\textbf{Explanation:} The \code{[1, 3, 2]} has three different positive integers ranging from 1 to 3, and the \code{[2, 1]} has exactly 2 distinct integers: 1 and 2.
0 commit comments