Skip to content

Commit

Permalink
update Summary.md and fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
labuladong committed Mar 7, 2020
1 parent 423fbdf commit 742cebd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ These articles are somehow kinds of **Algorithmic Thinking**. All based on LeetC

I don't like one liner and confusing, I like clear and easy-understanding.

Gitbook has deployed, will sync with this branch of the repo: https://labuladong.gitbook.io/algo-en/
**Gitbook** has deployed, will sync with this branch of the repo: https://labuladong.gitbook.io/algo-en/

If you want to clone this repo, please use following command:

Expand All @@ -26,14 +26,14 @@ This command specifies the `english` branch and limit the depth of clone, get ri
* [How to Check the Validation of Parenthesis](interview/valid-parentheses.md)
* [How to Find Missing Element](interview/missing_elements.md)
* [How to Pick Elements From a Arbitrary Sequence](interview/ReservoirSampling.md)
* [How to use Binary Search](interview/UsingBinarySearchAlgorithm.md)
* [How to Scheduling Seats](interview/Seatscheduling.md)
* [Union-Find Algorithm in Detail](think_like_computer/Union-find-Explanation.md)
* [Union-Find Application](think_like_computer/Union-Find-Application.md)
* [Find Sebesquence With Binary Search](interview/findSebesquenceWithBinarySearch.md)
* [如何运用二分查找算法](interview/koko偷香蕉.md)
* [Problems can be sloved by one line](interview/one-line-code-puzzles.md)
* [如何寻找缺失和重复的元素](interview/缺失和重复的元素.md)
* [如何判断回文链表](interview/判断回文链表.md)
* [一行代码就能解决的算法题](interview/一行代码解决的智力题.md)

* II. Data Structure
* [Binary Head and Priority Queue](data_structure/binary_heap_implements_priority_queues.md)
Expand All @@ -59,7 +59,7 @@ This command specifies the `english` branch and limit the depth of clone, get ri
* [Interval Scheduling: Interval Merging](think_like_computer/IntervalMerging.md)
* [Interval Scheduling: Intersections of Intervals](think_like_computer/IntervalIntersection.md)
* [String Multiplication](think_like_computer/string_multiplication.md)
* [烧饼排序](think_like_computer/烧饼排序.md)
* [Pancake Soring Algorithm](think_like_computer/PancakesSorting.md)
* [滑动窗口技巧](think_like_computer/滑动窗口技巧.md)
* [常用的位操作](think_like_computer/常用的位操作.md)
* [信封嵌套问题](think_like_computer/信封嵌套问题.md)
Expand Down
6 changes: 3 additions & 3 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
* [How to Check the Validation of Parenthesis](interview/valid-parentheses.md)
* [How to Find Missing Element](interview/missing_elements.md)
* [How to Pick Elements From a Arbitrary Sequence](interview/ReservoirSampling.md)
* [How to use Binary Search](interview/UsingBinarySearchAlgorithm.md)
* [How to Scheduling Seats](interview/Seatscheduling.md)
* [Union-Find Algorithm in Detail](think_like_computer/Union-find-Explanation.md)
* [Union-Find Application](think_like_computer/Union-Find-Application.md)
* [Find Sebesquence With Binary Search](interview/findSebesquenceWithBinarySearch.md)
* [如何运用二分查找算法](interview/koko偷香蕉.md)
* [Problems can be sloved by one line](interview/one-line-code-puzzles.md)
* [如何寻找缺失和重复的元素](interview/缺失和重复的元素.md)
* [如何判断回文链表](interview/判断回文链表.md)
* [一行代码就能解决的算法题](interview/一行代码解决的智力题.md)

* II. Data Structure
* [Binary Head and Priority Queue](data_structure/binary_heap_implements_priority_queues.md)
Expand All @@ -46,7 +46,7 @@
* [Interval Scheduling: Interval Merging](think_like_computer/IntervalMerging.md)
* [Interval Scheduling: Intersections of Intervals](think_like_computer/IntervalIntersection.md)
* [String Multiplication](think_like_computer/string_multiplication.md)
* [烧饼排序](think_like_computer/烧饼排序.md)
* [Pancake Soring Algorithm](think_like_computer/PancakesSorting.md)
* [滑动窗口技巧](think_like_computer/滑动窗口技巧.md)
* [常用的位操作](think_like_computer/常用的位操作.md)
* [信封嵌套问题](think_like_computer/信封嵌套问题.md)
Expand Down
8 changes: 4 additions & 4 deletions interview/one-line-code-puzzles.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ First of all, dynamic programming (DP) can be implemented into this problem, bec

**We usually use contrarian thinking to find a solution of this kind of problems**

If I win the game, I need to take the remaining stones (1~3 stones) at once.
If I win the game, I need to take the remaining stones (1\\~3 stones) at once.

How to make this situation come into being? If there are 4 stones remaining when your opponent takes the chance to pick the stones, no matter how he takes the stones, you can always win the game because there will always be 1~3 stones remaining.
How to make this situation come into being? If there are 4 stones remaining when your opponent takes the chance to pick the stones, no matter how he takes the stones, you can always win the game because there will always be 1\~3 stones remaining.

And how to force your opponent to face the situation when there are 4 stones left? If there are 5~7 stones remaining by the time you take your turn, you can let your opponent face 4-stone situation.
And how to force your opponent to face the situation when there are 4 stones left? If there are 5\~7 stones remaining by the time you take your turn, you can let your opponent face 4-stone situation.

Then how to get into a 5~7 stones situation when you are picking? Let your opponent face 8 stones. No matter how he plans to take the stones, we can win the game because of the remaining 5~7 stones.
Then how to get into a 5\~7 stones situation when you are picking? Let your opponent face 8 stones. No matter how he plans to take the stones, we can win the game because of the remaining 5\~7 stones.

And so on, we can find out that if n is a multiple of 4, you will fall into the trap and can never win the game. The solution to this problem is very simple:

Expand Down

0 comments on commit 742cebd

Please sign in to comment.