DOKICODE
書斎

スライディングウィンドウと Two Pointers

スライディングウィンドウは、配列や文字列の一区間を保ったまま両端を前に進めていく手法です。部分配列を毎回数え直す必要がなくなります。Two Pointers は同じ発想を一列または二列の数列に使うもので、全探索になりがちな問題を一回の走査で解けるようにします。

6 つの章は固定長ウィンドウから始まり、伸び縮みする可変長ウィンドウ、一列の Two Pointers、二列の Two Pointers、Three Pointers と進み、グループ分けループで終わります。ルートの最初の問題集なので、LeetCode を始めたばかりの人や、しばらく離れていて勘を取り戻したい人に向いています。

194 問レーティング 1165–28066 章
書斎を開く

誰かと一緒にこの問題集を進めたいなら、ログインして書斎を開いてみてください。ヒロインが一問ずつ出題してくれます。

一、Fixed-Length Sliding Window

二、Dynamic-Length Sliding Window (Two Pointers)

三、単一列の Two Pointers

§3.3 中心から外へ広がるTwo Pointers

問題レーティング
1793. Maximum Score of a Good Subarray1946
976. Largest Perimeter Triangle1263

四、二列の Two Pointers

五、Three Pointers

発展的な思考

問題レーティング
3464. Maximize the Distance Between Points on a Square2806

六、Grouped Loop

基礎問題

問題レーティング
485. Max Consecutive Ones1263
1446. Consecutive Characters1165
1869. Longer Contiguous Segments of Ones Than Zeros1205
2414. Length of the Longest Alphabetical Continuous Substring1222
3456. Find Special Substring of Length K1244
2273. Find Resultant Array After Removing Anagrams1295
2348. Number of Zero Filled Subarrays1316
1513. Number of Substrings with Only 1s1351
1957. Delete Characters to Make Fancy String1358
674. Longest Continuous Increasing Subsequence1263
3708. Longest Fibonacci Subarray1381
696. Count Binary Substrings1263
978. Longest Turbulent Subarray1393
2110. Number of Smooth Descent Periods of a Stock1408
228. Summary Ranges1263
2760. Longest Even Odd Subarray with Threshold1420
1887. Reduction Operations to Make the Array Elements Equal1428
845. Longest Mountain in Array1437
2038. Remove Colored Pieces If Both Neighbors Are the Same Color1468
2900. Longest Unequal Adjacent Groups Subsequence I1469
1759. Count Number of Homogenous Substrings1491
3011. Find If Array Can Be Sorted1497
1578. Minimum Time to Make Rope Colorful1574
1839. Longest Substring of All Vowels in Order1580
2765. Longest Alternating Subarray1581
3255. Find the Power of K Size Subarrays II1595
3350. Adjacent Increasing Subarrays Detection II1600
3105. Longest Strictly Increasing OR Strictly Decreasing Subarray1600
838. Push Dominoes1638
467. Unique Substrings in Wraparound String1700
3499. Maximize Active Section with Trade I1729
413. Arithmetic Slices1263
68. Text Justification1263
135. Candy1263
2948. Make Lexicographically Smallest Array by Swapping Elements2047
2593. Find Score of an Array After Marking All Elements1263
3640. Trionic Array II2278

新しいルートは必ずこの問題集の最初のセクションから始まり、3 つの任意セクションは印が付いたうえで発展編に回されるので、先へ進む妨げになりません。

レーティングは zerotrac さんによる LeetCode コンテストレーティングです。zerotrac のレーティングがない問題は「未評価」と表示されます。

書斎を開く