【拳不离手曲不离口系列】Leetcode-Weekly-Contest-58

第一题
http://storypku.com/2017/11/leetcode-question-724-find-pivot-index/

第二题
http://storypku.com/2017/11/leetcode-question-725-split-linked-list-in-parts/

第三题
http://storypku.com/2017/11/leetcode-question-726-number-of-atoms/

第四题
http://storypku.com/2017/11/leetcode-question-727-minimum-window-subsequence/

Leetcode-Question-502: IPO

Original Link:

https://leetcode.com/problems/ipo/

Solution:

Leetcode-Question-546: Remove Boxes

Original Link:

https://leetcode.com/problems/remove-boxes/

Solution:

【Approach #1】 3-D DP

Or

Leetcode-Question-664: Strange Printer

Original Link:

https://leetcode.com/problems/strange-printer/

Solution:

 

Leetcode-Question-720: Longest Word in Dictionary

Original Link:

https://leetcode.com/contest/leetcode-weekly-contest-57/problems/longest-word-in-dictionary/

Solution: 

【Approach #1】Brute Force

 

【Approach #2】Trie + BFS

 

 

Leetcode-Question-493: Reverse Pairs

原文链接:

https://leetcode.com/problems/reverse-pairs/

解析:

 

Leetcode-Question-486: Predict the Winner

原文链接:

https://leetcode.com/problems/predict-the-winner/

解析:

【法1】递归

【法2】2D DP

简化为1D DP

 

Leetcode-Question-717: 1-bit and 2-bit Characters

原文链接:

https://leetcode.com/contest/leetcode-weekly-contest-56/problems/1-bit-and-2-bit-characters/

解析:

 

Leetcode-Question-718: Maximum Length of Repeated Subarray

原文链接:

https://leetcode.com/contest/leetcode-weekly-contest-56/problems/maximum-length-of-repeated-subarray/

解析:

【初步】2D DP  竞赛的时候得到了一个Memory Limit Exceeded 的惩戒。。。莫名其妙。

【改进】1D DP

 

Leetcode-Question-719: Find K-th Smallest Pair Distance

原文链接:
https://leetcode.com/contest/leetcode-weekly-contest-56/problems/find-k-th-smallest-pair-distance/

解析:

Binary Search