C++ Crash Course
LeetCode 题解 + 报告 📝
题目会有我给予的相对难度评价 ➕ CF的估测难度对应分数
CF 分目测评估:
📗 800-1100 对应 Easy (E)
📙 1200-1700 对应 Medium (M)
📕 1700 - 2100 对应 Hard (H)
(代码以 C++ 和 Java 进行题解)
程序员面试经典 (Wait for Update...)
# | Title | Difficulty |
---|---|---|
1 | 判定字符是否唯一 | (E) 800 |
2 | 判定是否互为字符重排 | (E) 800 |
3 | URL化 | (E) 800 |
4 | 回文排列 | (E) 900 |
Premium
Array
#27. Remove Element (E) 800
#41. First Missing Positive (H-) 1600
#54. Spiral Matrix (M-) 1400
#134. Gas Station (M-) 1400
#189. Rotate Array(M) 1500
#228. Summary Ranges(E) 1000
#268. Missing Number(E) 900
#349. Intersection of Two Arrays(E) 900
#350. Intersection of Two Arrays II(E) 900
#414. Third Maximum Number (E) 900
#419. Battleships in a Board(M-) 1300
#442. Find All Duplicates in an Array (M-) 1400
#495. Teemo Attacking (M-) 1200
#665. Non-decreasing Array (E+) 1200
#795. Number of Subarrays with Bounded Maximum (M) 1500
#797. All Paths From Source to Target (M) 1500
#849. Maximize Distance to Closest Person (M-) 1400
#852. Peak Index in a Mountain Array (E) 800
#867. Transpose Matrix (E) 900
#905. Sort Array By Parity (E) 800
#944. Delete Columns to Make Sorted (E) 900
#1144. Decrease Elements To Make Array Zigzag (M) 1500
#1331. Rank Transform of an Array (E) 1000
#1380. Lucky Numbers in a Matrix (E) 900
#1572. Matrix Diagonal Sum (E) 800
#1582. Special Positions in a Binary Matrix(E) 900
#1588. Sum of All Odd Length Subarrays(E) 800
#1589. Maximum Sum Obtained of Any Permutation (M) 1500
#1646. Get Maximum in Generated Array (E) 800
#1652. Defuse the Bomb (E) 900
BFS
#117. Populating Next Right Pointers in Each Node II (M) 1400
#310. Minimum Height Tree (M+) 1600
#433. Minimum Genetic Mutation (M) 1500
#542. 01 Matrix (M) 1500
#675. Cut Off Trees for Golf Event (H-) 1700
#766. Toeplitz Matrix (M) 1400
#847. Shortest Path Visiting All Nodes (H) 1800
#854. K-Similar String (H) 1800
#994. Rotting Orange (M) 1400
#1036. Escape a Large Maze (H) 1800
#1298. Maximum Candies You Can Get from Boxes (H-) 1700
#1329. Sort the Matrix Diagonally (M) 1500
#1439. Find the Kth Smallest Sum of a Matrix With Sorted Rows (H) 1800
#1625. Lexicographically Smallest String After Applying Operations (M) 1500
#1631. Path With Minimum Effort (M) 1500
#1654. Minimum Jumps to Reach Home(M+) 1600
#LCP 09. 最小跳跃次数 (H) 1800
DFS
#17. Letter Combinations of a Phone Number (M-) 1400
#39. Combination Sum (M-) 1400
#40. Combination Sum II (M-) 1400
#130. Surrounded Regions (M-) 1400
#131. Palindrome Partitioning (M) 1500
#216. Combination Sum III (M-) 1400
#301. Remove Invalid Parentheses (H-) 1600
#306. Additive Number (M) 1500
#417. Pacific Atlantic Water Flow (M+) 1600
#473. Matchsticks to Square (M+) 1600
#488. Zuma Game (H) 1800
#491. Increasing Subsequences (M) 1500
#565. Array Nesting (M-) 1400
#690. Employee Importance (M-) 1200
#761. Special Binary String (H) 1800
#838. Push Dominoes (M) 1500
#842. Split Array into Fibonacci Sequence(M+) 1600
#967. Numbers With Same Consecutive Differences (M) 1500
#979. Distribute Coins in Binary Tree (M+) 1600
#988. Smallest String Starting From Leaf (M) 1500
#1020. Number of Enclaves (M-) 1400
#1239. Maximum Length of a Concatenated String with Unique Characters (M) 1500
#1240. Tiling a Rectangle with the Fewest Squares (H+) 2000
#1255. Maximum Score Words Formed by Letters (H-) 1700
#1377. Frog Position After T Seconds (M+) 1600
#1559. Detect Cycles in 2D Grid (H-) 1700
#1601. Maximum Number of Achievable Transfer Requests (H-) 1700
#LCP7. 传递信息 (M) 1400
Stack
#56. Merge Intervals (M-) 1400
#57. Insert Interval(M-) 1400
#84. Largest Rectangle in Histogram (H-) 1700
#94. Binary Tree Inorder Traversal (M-) 1400
#150. Evaluate Reverse Polish Notation (M) 1500
#316. Remove Duplicate Letters (M+) 1600
#682. Baseball Game (E+) 1100
#735. Asteroid Collision (M-) 1400
#1003. Check If Word Is Valid After Substitutions (M-) 1400
#1047. Remove All Adjacent Duplicates In String (E) 1000
#1063. Number of Valid Subarrays (H-) 1700
#1081. Smallest Subsequence of Distinct Characters (M+) 1600
#1190. Reverse Substrings Between Each Pair of Parentheses (M-) 1400
#1209. Remove All Adjacent Duplicates in String II (M-) 1400
#1249. Minimum Remove to Make Valid Parentheses (M-) 1400
#1544. Make The String Great (E+) 1100
#1614. Maximum Nesting Depth of the Parentheses (E) 900
LinkedList
Note: LinkedList can be used as stack or queue or deque
#2. Add Two Numbers (M-) 1300
#19. Remove Nth Node From End of List (M-) 1400
#24. Swap Nodes in Pairs (M) 1500
#82. Remove Duplicates from Sorted List II (M-) 1300
#83. Remove Duplicates from Sorted List (E) 1000
#86. Partition List (M-) 1300
#92. Reverse LinkedList II (M) 1500
#141. Linked List Cycle (E) 141
#146. LRU Cache (M+) 1600
#147. Insertion Sort List (M-) 1200
#203. Remove Linked List Elements (E) 900
#237. Delete Node in a Linked List(E) 1000
#328. Odd Even Linked List (M-) 1300
#341. Flatten Nested List Iterator (M-) 1400
#430. Flatten a Multilevel Doubly Linked List (M) 1500
#460. LFU (H) 1800
#817. Linked List Components (M-) 1300
#876. Middle of the Linked List (E) 900
#950. Reveal Cards In Increasing Order (M) 1500
Greedy
#45. Jump Game II (H-) 1600
#135. Candy (H-) 1700
#218. Skyline Problem (H) 1800
#253. Meeting Room II (M) 1500
#406. Queue Reconstruction by Height (M) 1500
#435. Non-overlapping Intervals (M) 1500
#452. Minimum Number of Arrows to Burst Balloonss (M) 1500
#522. Longest Uncommon Subsequence II (M-) 1300
#556. Next Greater Element III (M) 1500
#630. Course Schedule III (H-) 1700
#699. Falling Squares (H-) 1700
#729. My Calendar I (M) 1500
#731. My Calendar II (M+) 1600
#763. Partition Labels (M) 1500
#765. Couple Holding Hands (H-) 1600
#767. Reorganize String (M) 1500
#857. Minimum Cost to Hire K Workers (H) 1800
#861. Score After Flipping Matrix (M) 1500
#870. Advantage Shuffle (M) 1500 (sort+2 pointer)
#910. Smallest Range II (H-) 1700
#1007. Minimum Domino Rotations For Equal Row (M) 1500
#1029. Two City Scheduling (M+) 1600
#1111. Maximum Nesting Depth of Two Valid Parentheses Strings (M+) 1600
#1121. Divide Array Into Increasing Sequence (H-) 1700
#1199. Minimum Time Building Block (H) 1800
#1288. Remove Covered Intervals (M-) 1400
#1296. Divide Array in Sets of K Consecutive Numbers (M-) 1400
#1326.Minimum Number of Taps to Open to Water a Garden (H) 1800
#1328.Break a Palindrome (M-) 1300
#1383.Maximum Performance of a Team (H-) 1700
#1414.Find the Minimum Number of Fibonacci Numbers Whose Sum Is K (M+) 1600
#1432.Max Difference You Can Get From Changing an Integer (M-) 1400
#1520.Maximum Number of Non-Overlapping Substrings (H) 1900
#1540.Can Convert String in K Moves (M) 1500
#1591.Strange Printer II (H) 1800
#1605.Find Valid Matrix Given Row and Column Sums (M+) 1700
#1632.Rank Transform of a Matrix (H+) 2000
#1642.Furthest Building You Can Reach (M+) 1600
#1663.Smallest String With A Given Numeric Value (M-) 1400
#1665. Minimum Initial Energy to Finish Tasks (H-) 1700
#LCP 06. 拿硬币 (E) 800
Graph
#126. Word Ladder II(H) 1900
#133. Clone Graph(M) 1500
#785. Is Graph Bipartite?(M) 1500
#802. Find Eventual Safe States(M+) 1700
#863. All Nodes Distance K in Binary Tree(M) 1500
#886. Possible Bipartition(M) 1500
#1042. Flower Planting With No Adjacent(E+) 1300
#1153. String Transform into another String (H-) 1700
#1192. Critical Connection (H) 1900
#1245. Tree Diameter (M-) 1400
#1334. Find the City With the Smallest Number of Neighbors at a Threshold Distance (M) 1500 (Floyd-Warshall)
#1361. Validate Binary Tree Nodes (M) 1500
#1522. Diameter of N-Ary Tree (M-) 1300
#1568. Minimum Number of Days to Disconnect Island (H-) 1700
#1615. Maximal Network Rank (M) 1500
Maxflow - Bipartite Matching (二分图匹配)
- The size of a maximum flow in the resulting graph equals the size of a maximum matching in the original graph.
- Size of a minimum node cover always equals the size of a maximum matching.
- The complement of a maximum independent set is a minimum vertex cover(MAX Flow).
Reference : https://ali-ibrahim137.github.io/competitive/programming/2020/01/02/maximum-independent-set-in-bipartite-graphs.html
最大流: https://blog.csdn.net/chinacoy/article/details/45040897
#1349. Maximum Students Taking Exam (H+) 2000
#LCP04. 覆盖 (H+) 2000
Binary Search
#34. Find First and Last Position of Element in Sorted Array (M-) 1300
#35. Search Insert Position (E) 1000
#69. Sqrt(x) (E+) 1100
#153. Find Minimum in Rotated Sorted Array (M+) 1600
#154. Find Minimum in Rotated Sorted Array II (H-) 1700
#302. 包含全部黑色像素的最小矩形 (H-) 1700
#352. Data Stream as Disjoint Intervals (H-) 1700
#373. Find K Pairs with Smallest Sums (M) 1500
#374. Guess Number Higher or Lower (E) 800
#436. Find Right Interval (M) 1500
#475. Heaters (M) 1500
#704. Binary Search(E) 900
#744. Find Smallest Letter Greater Than Target (M-) 1200
#786. K-th Smallest Prime Fraction (H) 1800
#792. Number of Matching Subsequences (M+) 1600
#911. Online Election(M) 1500
#1095. Find in Mountain Array (H-) 1700
#1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold (M+) 1600
#1533. Find the Index of the Large Integer (M) 1500
#1552. Magnetic Force Between Two Balls (M+) 1600
#1574. Shortest Subarray to be Removed to Make Array Sorted (M+) 1600
#LCP08. 剧情触发时间 (M) 1600
#LCP12. 小张刷题计划 (M) 1500
Tree
#95. Unique Binary Search Trees II(M+) 1600
#96. Unique Binary Search Trees (M+) 1600
#98. Validate Binary Search Tree (M) 1500
#101. Symmetric Tree (M-) 1300
#110. Balanced Binary Tree (E) 900
#173. Binary Search Tree Iterator (M) 1500
#222. Count Complete Tree Nodes (M) 1500
#235. Lowest Common Ancestor of a Binary Search Tree (E+) 1100
#236. Lowest Common Ancestor of a Binary Tree (M-) 1400
#257. Binary Tree Paths (E) 1000
#617. Merge Binary Tree (E) 1000
#623. Add One Row to Tree (M-) 1300
#654. Maximum Binary Tree (M-) 1400
#669. Trim a Binary Search Tree (M-) 1400
#783. Minimum Distance Between BST Nodes (E) 900
#872. Leaf-Similar Trees (E) 900
#1026. Maximum Difference Between Node and Ancestor (M-) 1400
#1080. Insufficient Nodes in Root to Leaf Paths (M) 1500
#1110. Delete Nodes And Return Forest (M-) 1400
#1123. Lowest Common Ancestor of Deepest Leaves (M) 1500
#1339. Maximum Product of Splitted Binary Tree (M) 1500
#1372. Longest ZigZag Path in a Binary Tree (M) 1500
#1457. Pseudo-Palindromic Paths in a Binary Tree (M-) 1300
#1490. Clone N-tree (M-) 1300
#1516. Move Sub-Tree of N-Ary Tree (H-) 1700
#1617. Count Subtrees With Max Distance Between Cities (H) 1800
Trie
#208. Implement Trie (Prefix Tree) (M) 1500
#211. Design Add and Search Words Data Structure (M) 1500
#421. Maximum XOR of Two Numbers in an Array (M+) 1600
DP
#10. Regular Expression Matching (H) 1900
#44. Wildcard Matching (H-) 1700
#70. Climbing Stairs (E) 900
#85. Maximal Rectangle (H-) 1700
#91. Decode Way (M+) 1700
#97. Interleaving String (H-) 1700
#118. Pascal's Triangle (E) 900
#119. Pascal's Triangle II (E) 1000
#120. Triangle (M-) 1300
#123. Best Time to Buy and Sell Stock III (H-) 1700
#132. Palindrome Partitioning II (H-) 1700
#139. Word Break (M) 1500
#140. Word Break II (H) 1800
#188. Best Time to Buy and Sell Stock IV (H) 1800
#198. House Robber (M) 1400
#213. House Robber II (M) 1500
#279. Perfect Square(M-) 1300
#309. Best Time to Buy and Sell Stock with Cooldown (M) 1500
#312. Burst Balloons (H) 1800
#322. Coin Change (M-) 1400
#363. Max Sum of Rectangle No Larger Than K (M) 1800
#403. Frog Jump (H-) 1700
#413. Arithmetic Slices (M) 1500
#446. Arithmetic Slices II - Subsequence (H-) 1700
#466. Count Repetition (H) 1800
#514. Freedom Trail (H) 1800
#518. Coin Change 2 (M) 1500
#691. Stickers to Spell Word (H) 1900
#714. Best Time to Buy and Sell Stock with Transaction Fee (M+) 1600
#717. 1-bit and 2-bit Characters (E) 1000
#718. Maximum Length of Repeated Subarray (M) 1500
#727. Minimum Window Subsequence (H) 1800
#730. Count Different Palindromic Subsequences (H) 1800
#740. Delete and Earn (M) 1500
#741. Cherry Pickup (H) 1800
#764. Largest Plus Sign (M) 1500
#790. Domino and Tromino Tiling(M+) 1700
#798. Smallest Rotation with Highest Score (H) 1900
#801. Minimum Swaps To Make Sequences Increasing (M+) 1600
#805. Split Array With Same Average (H) 1800
#823. Binary Trees With Factors (M) 1500
#828. Count Unique Characters of All Substrings of a Given String (H) 1900
#837. New 21 Game (M+) 1600
#887. Supper Egg drop (H) 1800
#902. Numbers At Most N Given Digit Set (H) 1800
#903. Valid Permutations for DI Sequence (H) 1800
#918. Maximum Sum Circular Subarray (M) 1500
#920. Number of Music Playlists (H) 1800
#940. Distinct Subsequences II (H) 1800
#943. Find the Shortest Superstring (H) 1900
#968. Binary Tree Camera (H+) 2000
#983. Minimum Cost For Tickets (M) 1500
#1000. Minimum Cost to Merge Stones (H+) 2000
#1012. Numbers With Repeated Digits (H) 1800
#1027. Longest Arithmetic Subsequence (M) 1500
#1029. Two City Scheduling (M) 1500
#1039. Minimum Score Triangulation of Polygon (M+) 1700
#1066. Campus Bike II (H-) 1700
#1092. Shortest Common Supersequenceg (H) 1800
#1137. N-th Tribonacci Number (E) 900
#1139. Largest 1-Bordered Square (M) 1600
#1155. Number of Dice Rolls With Target Sum (M+) 1600
#1125. Smallest Sufficient Team (H) 1800
#1259. Handshakes That Don't Cross (H-) 1700
#1277. Count Square Submatrices with All Ones (M) 1500
#1359. Count All Valid Pickup and Delivery Options (H-) 1700
#1388. Pizza With 3n Slices (H) 1800
#1402. Reducing Dishes (H-) 1600
#1420. Build Array Where You Can Find The Maximum Exactly K Comparisons(H) 1800
#1458. Max Dot Product of Two Subsequences (H-) 1600
#1473. Paint House III (H) 1800
#1478. Allocate Mailboxes (H) 1900
#1546. Maximum Number of Non-Overlapping Subarrays With Sum Equals Target (M+) 1600
#1548. The Most Similar Path in a Graph (H) 1800
#1563. Stone Game V (H-) 1700
#1563. Number of Ways to Reorder Array to Get Same BST (H) 1900
#1575. Count All Possible Routes (H) 1800
#1621. Number of Sets of K Non-Overlapping Line Segments (M+) 1700
#1639. Number of Ways to Form a Target String Given a Dictionary (H) 1800
#1641. Count Sorted Vowel Strings (M-) 1400
#1653. Minimum Deletions to Make String Balanced (M) 1500
#1655. Distribute Repeating Integers(H) 1800
#1659. Maximize Grid Happiness(H+) 2200
#LCP10. 二叉树任务调度 (H+) 2200
#LCP13. 寻宝 (H+) 2100
#LCP14. 切分数组 (H+) 2200
Math
#60. Permutation Sequence (M+) 1600
#172. Factorial Trailing Zeroes (M-) 1400
#233. Number of Digit One (H) 1900
#396. Rotate Function (M-) 1400
#440. K-th Smallest in Lexicographical Order (H+) 1900
#453. Minimum Moves to Equal Array Elements (E+) 1100
#463. Island Perimeter (E) 900
#553. Optimal division (M-) 1300
#598. Range Addition II (E)) 900
#799. Champagne Tower(M) 1500
#836. Rectangle Overlap (E+) 1100
#869. Reordered Power of 2 (M-) 1300
#880. Decoded String at Index (M+) 1600
#891. Sum of Subsequence Widths (H) 1800
#888. Fair Candy Swap (E) 1000
#908. Smallest Range I (E+) 1100
#957. Prison Cells After N Days (M) 1500
#976. Largest Perimeter Triangle (E) 900
#1006. Clumsy Factorial (M) 1500
#1018. Binary Prefix Divisible By 5 (E) 1000
#1024. Vedio Stichting (M) 1600
#1041. Robot Bounded In Circle (M) 1500
#1103. Distribute Candies to People(E+) 1300
#1128. Number of Equivalent Domino Pairs (E) 1000
#1131. Maximum of Absolute Value Expression (M+) 1600
#1237. Find Positive Integer Solution for a Given Equation (E) 1000
#1415. The k-th Lexicographical String of All Happy Strings of Length n (M+) 1600
#1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts (M-) 1200
#1498. Number of Subsequences That Satisfy the Given Sum Condition (M+) 1600
#1551. Minimum Operations to Make Array Equal (M-) 1200
#1573. Number of Ways to Split a String (M) 1500
#1622. Fancy Sequence (H+) 2000
#1643. Kth Smallest Instructions (H) 1800
#1648. Sell Diminishing-Valued Colored Balls (M+) 1600
#LCP3. 机器人大冒险 (M) 1500
#LCP11. 期望个数统计 (M-) 1400
Prefix Sum
#1664. Ways to Make a Fair Array (M) 1500
Geometry
#1610. Maximum Number of Visible Points(H) 1800
Moore's Voting
#169. Majority Element (M-) 1200
#229. Majority Element (M) 1500
Segment Tree
#308. Range Sum Query 2D - Mutable (2D Segment Tree) (H) 2100
#715. Range Module (H) 1900
#1505. Minimum Possible Integer After at Most K Adjacent Swaps On Digits (BIT) (H) 1900
#1585. Check If String Is Transformable With Substring Sort Operations (Segment Tree) (H+) 2400
#1649. Create Sorted Array through Instructions (BIT) (H) 1800
#LCP5. 发leetcoin (H+) 2300
#b857. Delete Integers In Ascending Order (BIT) (H) 1800
Sparse Table
#1310. XOR Queries of a Subarray (M) 1500
#1483. Kth Ancestor of a Tree Node (H) 1800
Observation
#667. Beautiful Arrangement II (M) 1500
#777. Swap Adjacent in LR String (M+) 1600
#899. Orderly Queue (H-) 1700
#1109. Corporate Flight Bookings (M) 1500
#1538. Guess the Majority in a Hidden Array (M+) 1700
Sliding Window
#3. Longest Substring Without Repeating Characters (M-) 1400
#76. Minimum Window Substring (M+) 1700
#395. Longest Substring with At Least K Repeating Characters (M+) 1700
#424. Longest Repeating Character Replacement (M) 1500
#713. Subarray Product Less Than K (M) 1500
#904. Fruit Into Baskets (M-) 1300
#933. Number of recent call (E) 1000
#992. Subarrays with K Different Integers (H) 1800
#1040. Moving Stones Until Consecutive II (M+) 1600
#1052. Grumpy Bookstore Owner (M) 1500
#1156. Swap For Longest Repeated Character Substring (M) 1500
#1208. Get Equal Substrings Within Budget (M-) 1400
#1456. Maximum Number of Vowels in a Substring of Given Length (M-) 1300
Two Pointer
#80. Remove Duplicates from Sorted Array II (M-) 1400
#455. Assign Cookies (E) 1000
#524. Longest Word in Dictionary through Deleting (M-) 1400
#632. Smallest Range Covering Elements from K Lists (H) 1800
#881. Boats to Save People (M-) 1400
#923. 3Sum With Multiplicity (M+) 1600
#925. Long Pressed Name (E) 1000
#986. Interval List Intersections (M) 1500
Sort
#179. Largest Number (M) 1500
#215. Kth Largest Element in an Array (Quick Select) (M) 1500
#252. Meeting Room (E) 1000
#295. Find Median from Data Stream (H-) 1600
#581. Shortest Unsorted Continuous Subarray (E) 1000
#791. Custom Sort String (M-) 1300
#955. Delete Columns to Make Sorted II (M+) 1600
#1030. Matrix Cells in Distance Order (E) 900
#1366. Rank Teams by Votes (M+) 1600
#1629. Slowest Key (E) 900
#1636. Sort Array by Increasing Frequency (E+) 1100
String
#6. ZigZag Conversion (M-) 1300
#9. Palindrom Number (E) 900
#28. Implement strStr(M) 1500 (KMP)
#49. Group Anagrams (M-) 1300
#151. Reverse Words in a String (M-) 1300
#214. Shortest Palindromem (H-) (KMP) 1700
#242. Valid Anagram (E) 900
#290. Word Pattern (E) 1000
#336. Palindrome Pairs (H) 1800
#696. Count Binary Substrings (E) 1000
#833. Find And Replace in String (M) 1500
#811. Subdomain Visit Count (E) 800
#859. Buddy Strings (E) 1000
#906. Super Palindrom (H) 1800
#936. Stamping The Sequence (H+) 2300
#953. Verifying an Alien Dictionary (E) 1000
#1163. Last Substring in Lexicographical Order (H-) 1700
#1446. Consecutive Characters (E) 900
#1616. Split Two Strings to Make Palindrome (M+) 1600
#1624. Largest Substring Between Two Equal Characters (E) 900
Game Theory
#292. Nime Game (M-) 1400
#365. Water and Jug Problem (M+) 1600
#375. Guess Number Higher or Lower II (M+) 1600
#486. Predict the Winner (M) 1500
#521. Longest Uncommon Subsequence I (E) 800
#789. Escape The Ghosts (M-) 1400
#843. Guess The World (H-) 1700
#877. Stone Game (M+) 1600
#913. Cat and Mouse (H+) 2400
#1025. Divisor Game (E+) 1100
#1140. Stone Game II (M+) 1600
Implementation
#7. Reverse Integer (E) 900
#26. Remove Duplicates from Sorted Array (E) 800
#68. Text Justification (H) 1800
#202. Happy Number (E) 800
#258. Add Digits (E) 800
#747. Largest Number At Least Twice of Others (E) 900
#806. Number of Lines To Write String (E) 900
#1071. Greatest Common Divisor of Strings (E) 900
#1550. Three Consecutive Odds (E-) 700
#1640. Check Array Formation Through Concatenation (E) 1000
#1662. Check If Two String Arrays are Equivalent (E) 800
Bit
#201. Bitwise AND of Numbers Range (M+) 1600
#318. Maximum Product of Word Lengths (M) 1500
#898. Bitwise ORs of Subarrays (M+) 1600
#1178. Number of Valid Words for Each Puzzle (H-) 1700
#1290. Convert Binary Number in a Linked List to Integer (E) 900
#1371. Find the Longest Substring Containing Vowels in Even Counts (M) 1500
#1318. Minimum Flips to Make a OR b Equal to c (M) 1500
#1404. Number of Steps to Reduce a Number in Binary Representation to One (M+) 1600
#1611. Minimum One Bit Operations to Make Integers Zero (H) 1800
Hash
#30. Substring with Concatenation of All Words(H-) 1700
#219. Contains Duplicate II (E) 800
#220. Contains Duplicate III (M) 1500
#409. Longest Palindrom (E) 900
#594. Longest Harmonious Subsequence (E) 1000
#804. Unique Morse Code Words (E) 800
#825. Friends Of Appropriate Ages(M-) 1300
#893. Groups of Special-Equivalent Strings (E) 1000
#954. Array of Doubled Pairs(M-) 1400
#1267. Count Servers that Communicate (M-) 1300
#1282. Group the People Given the Group Size They Belong To (M-) 1300
#1396. Design Underground System (M) 1500
Divide Conquer
#315. Count of Smaller Numbers After Self(H-) 1700
#327. Count of Range Sum(H) 1800
#454. 4 sum II (M-) 1400
#932. Beautiful Array (M+) 1700
Union Find
#947. Most Stones Removed with Same Row or Column (M) 1500
#990. Satisfiability of Equality Equations (M) 1500
#1202. Smallest String With Swaps (M+) 1600
#1579. Remove Max Number of Edges to Keep Graph Fully Traversable (H) 1900
#1584. Min Cost to Connect All Points (M) 1500
#1627. Graph Connectivity With Threshold (H) 1800
Ordered Map
#1606. Find Servers That Handled Most Number of Requests(H) 1800
SQL
#175. Combine Two Tables (E)
#177. Nth Highest Salary (M)
#180. Consecutive Numbers (M)
#181. Employees Earning More Than Their Managers (E)
#182. Duplicate Emails (E)
#183. Customers Who Never Order (E)
#184. Department Highest Salary (M)
#197. Rising Temperature (E)
#511. Game Play Analysis I (E)
#595. Big Countries (E)
#596. Classes More Than 5 Students (E)
#607. Sales Person (E)
#620. Not Boring Movie (E)
#1082. Sales Analysis I (E)
#1303. Find the Team Size (E)
#1407. Top Travellers (E)
#1565. Unique Orders and Customers Per Month (E)
力扣秋季赛
#LCP17. 速算机器人 (E) 900
#LCP18. 早餐组合 (M-) 1400
#LCP19. 秋叶收藏集 (M+) 1600
#LCP20. 快速公交 (H) 1800
#LCP21. 追逐游戏 (H) 1900
力扣2020秋季战队赛
#LCP22. 黑白方格画 (M) 1500
#LCP23. 魔术排列 (M+) 1600
#LCP24. 数字游戏 (H+) 2000
#LCP25. 古董键盘 (H) 1900
#LCP26. 导航装置 (H+) 2400
#LCP27. 黑盒光线反射 (H+) 2300
📌 ACM 练习
精刷 200 题
参照以下 links:
🔗 https://github.com/yogykwan/acm-challenge-workbook
🔗 https://blog.csdn.net/u011613729/article/details/9788669
Two pointer
#POJ 2739. Sum of Consecutive Prime Numbers (M) 1500
DFS
#POJ 1979. Red and Black (M-) 1400
枚举
#POJ 1753. Flip Game (H) 1800
反转(开关)
#POJ 3185. The Water Bowls (M+) 1600
Minimum Spanning Tree
#POJ 1258. Agri-Net POJ (M) 1600
Strong Connect Component (强连通)
🔗 Source: https://iq.opengenus.org/tarjans-algorithm/ (Tarjan for SCC)
Tarjan 和Kosaraju’s 同等适用与找强连通
#POJ 1236. Network of Schools (H+) 2200
#POJ 3713. Transferring Sylla (H+) 2200
Binary Search
#POJ 3685. Matrix (H) 1800
DP
#POJ 1159. Palindrom (H-) 1700
#POJ 1458. Balance (M) 1500
#POJ 1837. Balance (H-) 1700
#POJ 2229. Sumsets (M) 1500
#POJ 2479. Maximum sum (M+) 1600
贪心
#POJ 1844. Sum (M+) 1600
#POJ 3614. Sunscreen (H-) 1700
二分图匹配
#POJ 1274. The Perfect Stall (H-) 1700
🔗 BinarySearch.io
一个不错新的面试刷题网站
#B6. Omitted (M-) 1400
#B11. Unival Tree Count (M-) 1300
#B12. Longest Substring with K Distinct Characters (H-) 1600
#B13. Collecting Coins (M-) 1400
#B14. Counting Dinosaurs (E) 900
#B15. Tom Sawyer (M+) 1600
#B26. Longest Palindromic Subsequence (H-) 1700
#B27. LCS (M) 1500
#B44. Largest Rectangle (H-) 1700
#B48. Sunk Islands (M) 1500
#B58. High Frequency (E) 900
#B76. Making Coin Change (M-) 1300
#B81. Tree Pruning (M-) 1400
#B83. Climing down the tree (M-) 1400
#B87. The quick brown fox (M+) 1600
#B88. Connected Cities (H-) 1700
#B91. Chunky strings (E) 900
#B94. Detecting an odd length cycle (H) 1800
#B97. Repeated Deletion (M-) 1400
#B106. Unique subsequence (H-) 1700
#B111. List Min Replacement (E) 1000
#B115. Longest Zero Sublist Sum (M) 1500
#B129. Pigeonhole (E+) 1100
#B190. Minimum Bracket Addition (E) 1000
#B193. Sum Tree (M-) 1300
#B200. Odd number of digits (E-) 800
#B207. Mad Max (H-) 1700
#B217. Longest common subsequence of three strings (H) 1800
#B251. Largest tree sum path (M+) 1600
#B277. Unique Characters of Every Substring (H) 1800
#B286. Minimum Difference (M)1500
#B299. Subsequence Picking (H)1900
#B315. Minimum Spanning Tree (H)1800
#B342. Equal Piles (M-)1400
#B357. Longest Alternating Subsequence (M)1500
#B358. Bus Fare (M)1600
#B362. Number Flip (E)900
#B372. Longest Even Sum Path (H)1800
#B375. The Meeting Place (M)1500
#B390. Range Update (M)1500
#B424. Outstanding Move (H-)1700
#B438. 0-1 Knapsack (M+)1600
#B459. Anagram Substrings (M-) 1400
#B464. Count Exact Sum (H-) 1700
#B503. Small Large Medium (M+)1600
#B539. Divisible Numbers (H)1800
#B591. Connect Forest (H)1800
#B682. Concatenated Sums (M)1500
#B687. Candy Race with Different Types (M)1500
#B688. Number of K-Divisible Sublists (M)1500
#B689. Number of K-Length Sublists with Average at Least Target (M-)1300
#B690. Partition List to Pairs that are Divisible by K (M-)1300
#B700. Create Palindrome After Deleting at Most K Characters (H-)1700
#B701. Minimum Size of Two Non-Overlapping Intervals (M)1500
#B703. Genetic Mutation (M+)1600
#B708. Maximum Additive Score by Removing Numbers (H-)1700
#B709. Arrange Symbols to Create Sum (M+)1600
#B713. Minimum Difference of Extremes (M-)1400
#B731. Deleting Repeated Integers Game (M+)1600
#B733. Matrix Prefix Sum (M-)1300
#B736. Maximal Points from Deleting Two Character Substrings (H-)1700
#B741. Graph Weight Queries (H)1800
#B742. Even Frequency (E)800
#B744. Lowest Sum of Pair Larger than Target(M-)1400
#B747. Minimum Time to Finish K Tasks(H-)1700
#B748. Maximum XOR Queries(H)1800 (Trie)
#B816. Task Run(E+)1100 (Array)
#B818. Non-Overlapping Pairs of Sublists(M+)1600 (Array)
👊 CodeForce Contest
统计(1800+ 题量): 98
Beta Round #3
B. Lorry (1900)贪心 + sort
D. Least Cost Bracket Sequence (2600)贪心
Beta Round #4 (Div. 2)
A. Watermelon (800)
B. Before an exam (1200)
C. Registration System (1200)
D. Mysterious Present (1700) DP
Beta Round #25 (Div. 2)
A. IQ test (1300)
B. Phone Number (1100)
C. Roads in Berland (1900) (Shortest path+path compression)
D. Roads not only in Berland (1900) (Union Find)
E. Test(2200) (KMP)
Beta Round #34 (Div. 2)
A. Reconnaissance 2 (800)
B. Sale (900)
D. Road Map (1600) Tree
Beta Round #40 (Div. 2)
A. Translation (800)
B. Martian Dollar (1400)
C. Email address (1300)
D. Pawn (1900) dp+打表
E. 3-Cycle (1900) (Graph+Thinking+Observation)
Beta Round #59 (Div. 2)
A. Sinking Ship (800)
B. Settlers' Training (1200)
C. Bulls and Cows (1700)
D. Dividing Islands (1900) (Greedy+Implmentation)
E. Sweet Game (2000) (Game Theory+Matrix)
Beta Round #63 (Div. 2)
A. Young Physicist1 (1000)
B. Bets (1200)
D. Dot (1900) (Game+Dp)
E. Subsegments (1800) (Sliding Window)
Beta Round #95 (Div. 2)
A. cAPS lOCK (1000)
B. Opposites Attract (1200)
C. The World is a Theatre (1400)
D. Subway (1600) (Graph Cycle)
E. Yet Another Task with Queens (1700) (2D Matrix Sort)
F. Present to Mom(2000) (2D Matrix + prefix + Siding window)
Beta Round #98 (Div. 2)
A. Postcards and photos (900)
B. Permutation (1000)
C. History (1500)
D. Palindromes (1900) (DP)
E. Last Chance (2000) (Segment Tree + prefix sum)
Codeforces Round #150 (Div. 1)
A. The Brand New Function (1600)
B. Hydra (2000) (集合相交)
Codeforces Round #218 (Div. 2)
371A.K-Periodic Array (Greedy) (1000)
371B.Fox Dividing Cheese (Math) (1300)
371C. Hamburgers (Binary Search + Math) (1600)
371D. Vessels (Ordered Map) (1800)
371E. Subway Innovation (Prefix Sum+Math) (2000)
Codeforces Round #295 (Div. 2)
A. Pangram (800)
B. Two Buttons (1400)
C. DNA Alignment (1500) (Math+Observation)
E. Pluses everywhere (2200) (Math+组合数学)
Codeforces Round #306 (Div. 2)
A. Two Substrings (1500) (dp)
B. Preparing Olympiad (1400) (BitMask+BruteForce)
C. Divisibility by Eight (1500)
D. Regular Bridge (1900) (Graph+Math)
E. Brackets in Implications (2200) (Implementation+Math)
Codeforces Round #550 (Div. 3)
A. Diverse Strings (800)
B. Parity Alternated Deletions (900)
C. Two Shuffled Sequences (1000)
D. Equalize Them All (1400) (排序)
E. Median String (1900) (数学位算)
F. Graph Without Long Directed Paths(1700) (二分图解)
Codeforces Round #578 (Div. 2)
A. Hotelier(800)
B. Block Adventure(1200) (Greedy)
C. Round Corridor (1400) (Math)
D. White Lines (1900) (Prefix sum+Implementation heavy)
E. Compress Words (2000) (String + KMP)
Codeforces Round #595 (Div. 3)
A. Yet Another Dividing into Teams (800)
B1. Booking Exchange (Easy) (1000)
B2. Books Exchange (hard version) (1300)
C1. Good Number (Easy) (1300)
C2. Good Number (hard version) (1500)
D1. Too Many Segments (easy version) (1800)
D2. Too Many Segments (hard version) (1800)
E. By Elevator or Stairs? (1700) (DP)
F. Maximum Weight Subset (2200) (Tree DP)
Codeforces Round #605 (Div. 3)
A. Three Friends (900)
B. Snow Walking Robot (1200)
C. Yet Another Broken Keyboard (1200) Math+Com
D. Remove One Element (1500) DP
E. Nearest Opposite Parity (1900) 反向+多源dfs
F. Two Bracket Sequences (2200) dp
Codeforces Round #611 (Div. 3)
A. Minutes Before the New Year (800)
B. Candies Division (900)
C. Friends and Gifts (1500)
D. Christmas Trees (1800) (BFS)
E. New Year Parties (1800) (Greedy)
F. DIY Garland (2200) (Greedy+Tree+Heap)
Codeforces Round #617 (Div. 3)
A. Array with Odd Sum (800)
B. Food Buying (900)
C. Yet Another Walking Robot (1500)
D. Fight with Monsters (1500) (Math+Sort)
E1. String Coloring (easy version) (1800) (Observation + Greedy)
E2. String Coloring (hard version) (2000)
F. Berland Beauty (2100) (dfs+tree+greedy+sort)
Codeforces Round #624 (Div. 3)
A. Add Odd or Subtract Even (800)
B. WeirdSort (1200)
F. Moving Point (1900) Segment Tree
Codeforces Round #640 (Div. 4)
A. Sum of Round Numbers (800)
B. Same Parity Summands (1200)
C. K-th Not Divisible by n (1200)
D. Alice, Bob and Candies (1300)
E. Special Element (1500) (暴力)
F. Binary String Reconstruction (1500) (暴力+观察)
G. Special Permutation (1600) (观察+Implementation)
Codeforces Round #661 (Div. 3)
A. Remove Smallest (800)
B. Gifts Fixing (800)
C. Boat Competition (1200)
D. Binary String To Subsequences (1500)
E1. Weights Division (easy version) (2000)
E2. Weights Division (Hard version) (2200)
Codeforces Round #666 (Div. 2)
A. Juggling Letters (800)
B. Power Sequence (1500)
C. Multiples of Length (1600) (贪心)
D. Stoned Game (1800) (游戏)
E. Monster Invader (2300) (复杂dp)
Codeforces Round #667 (Div. 3)
A. Yet Another Two Integers Problem (800)
B. Minimum Product (1100)
C. Yet Another Array Restoration (1200)
D. Decrease the Sum of Digits (1500)
E. Two Platforms (双指针+dp) (1800)
F. Subsequences of Length Two (dp) (2100)
Codeforces Round #668 (Div. 2)
A. Permutation Forgery (800)
B. Array Cancellation (1000)
C. Balanced Bitstring (1500)
D. Tree Tag (1900)(game)
E. Fixed Point Removal (2300)(线段树+二分法)
Codeforces Round #669 (Div. 2)
A. Ahahahahahahahaha (1100)
B. Big Vova (1300)
D. Discrete Centrifugal Jumps (2200) (dp+stack)
Codeforces Round #670 (Div. 2)
A. Subset Mex (900)
B. Maximum Product (1200)
C. Link Cut Centroids (1700)
D. Three Sequences (2200)
Codeforces Round #672 (Div. 2)
A. Cubes Sorting (Sort) (900)
B. Rock and Lever (Bit) (1200)_
C1. Pokémon Army (easy version) (DP) (1300)
C2. Pokémon Army (Hard version) (Greedy+Math) (2100)
D. Rescue Nibel! (Combination) (1800)
Codeforces Round #673 (Div. 2)
A. Copy-paste (900)
B. Two Arrays (1100)
C. K-Amazing Number (1500)
D. Make Them Equal (2000) Greedy
E. Xor Inverse (2000) Bit+Trie
Codeforces Round #674 (Div. 3)
A. Floor Number (800)
B. Symmetric Matrix (900)
C. Increase and Copy (Binary Search+Math) (1100)
D. Non-zero Segments (1500)
E. Rock, Paper, Scissors (1800) (MAX Flow)
F. Number of Subsequences (2000) (Combanation+Math)
Codeforces Round #675 (Div. 2)
A. A - Fence (800)
B. Nice Matrix (1300)
C. Bargain (1700)
D. Returning Home (2300) (Graph+Shortest Path)
Codeforces Round #677 (Div. 3)
A. Boring Apartments (800)
B. Yet Another Bookshelf (800)
C. Dominant Piranha (900)
D. Districts Connection (1200)
E. Two Round Dances (1300)
F. Zero Remainder Sum (2100)
G. Reducing Delivery Cost (2100) (Shortest Path)
Codeforces Round #683 (Div. 2)
A. Add Candies (800)
B. Numbers Box (800)
C. Knapsack (1300)
D. Catching Cheaters (1800)
E. Xor Tree(2100)
Educational Codeforces Round 83 (Div. 2)
1312B. Bogo Sort (DIV 2) (1000)
1312C. Adding Power (DIV 2) (1400) number theory
1312D. Count the Arrays (DIV 2) (1700) 组合数学+number theory
1312E. Array Shrinking (DIV 2) (2100) 区间dp
Educational Codeforces Round 93 (Div. 2)
EDU93B. Bad Triangle (800)
EDU93B. Substring Removal Game (800)
EDU93C. Good Subarrays (1600) Math+prefixSum
EDU93D. Colored Rectangles (1800) DP
Grakn Forces 2020 (Div. 2)
GFA. Circle Coloring (800)
GFB. Arrays Sum (1400) (Math)
GFC. Discrete Acceleration (1500) Binary Search
GFD. Searchlights (2000)
GFE. Avoid Rainbow Cycles (2400) (Union Find)
GFF. Two Different (2300)(Bit Mask)
Codeforces Global Round 11
GLOA. Avoiding Zero (900)
GLOB. Chess Cheater (1400) (Sort+Greedy)
GLOC. The Hard Work of Paparazzi (2000) DP
GLOD. Unshuffling a Deck (2000) sort
NYU Progteam Spring Break Practice 3/16/2020
https://vjudge.net/contest/362056
709A. Juicer (900)
757A. Gotta Catch Em' All! (1000)
514A. Chewbaсca and Number (1200)
804B. Minimum number of steps (1400) (Math+Observation)
687A. NP Hard Problem (1500) (二分图)
782B. The Meeting Place Cannot Be Changed (1600) (Binary Search)
484A. Bits (1700) (Bit+Greedy)
778A. String Game (1700) (Binary Search)
706D. Vasiliy's Multiset (1800) (Trie)
721C. Journey (1800) (Graph)
NYU Progteam Friday Night 2/28/2019 (Greedy)
https://vjudge.net/contest/359373
415D. Mashmokh and ACM (1400) (dp)
1148A. Another One Bites The Dust (800)
1158B. Game with Telephone Numbers (1200) (Greedy+Game)
383A. Milking cows (1600)
1098A. Sum in the tree (1600)
Algorithm Template
Suffix Array (后缀数组 (nlog^2 n))
Combination C(n,k) in mod
Max Flow Dinic
Shortest Path
2 SAT
Kosaraju
Fenwick Tree
Hopcroft (Solving Maximum matching Cardinality for Bipartile Graph) O(sqrt(n)*m)
Min Seg
Lazy Seg
Double Linkedlist
CodeForce 日常水题 ( 小于1500分 )
38A.Army (Implementation)
119A.Epic Game (Implementation)
791A.Bear and Big Brother (Implementation)
1178A.Prime Minister (Greedy)
1430B. Barrels (Sort)
1445A.Array Rearrangment (Greedy)
1445B.Eliminationt (Math)
29A.Spit Problem
371A.K-Periodic Array (Greedy)
1038B.Non-Coprime Partition (Math)
18C.Stripe
23A.You're Given a String...
298A.Snow Footprints (Greedy)
371B.Fox Dividing Cheese (Math)
1038C.Gambling (Game)
1178B.WOW Factor
1178C.Tiles
1234B2.Social Network (hard version) (LinkedList)
1285B.Just Eat It! (prefix sum)
1443B.Saving the City (dp)
205B.Little Elephant and Sorting
53D.Physical Education! (Sort)
1178D.Prime Graph (Graph+Brute Force)
CodeForce 日常刷题
28B. pSort (Union Find)
46C. Hamsters and Tigers (Sliding Window)
371C. Hamburgers (Binary Search + Math)
788A. Functions again (Prefix)
1077D. Cutting Out (Binary Search)
18B. Platforms (Math)
29C. Mail Stamps (Graph)
160C. Find Pair (Math)
627A. XOR Equation (Bit + DP)
1430D. String Deletion (Greedy)
38E. Let's Go Rolling! (DP)
371D. Vessels (Ordered Map)
747D. Winter Is Coming (Greedy+ Sort)
846C. Four Segments (Prefix)
1077E. Thematic Contests (Binary Search)
1154E. Two Teams (TreeMap+Fenwick)
14D. Two Path
22D. Segment (sort+Greedy)
19B. Checkout Assistant (DP)
448C. Painting Fence (Divide Conquer+Greedy)
1178E. Archaeology (Greedy)
1430E. String Reversal (BIT)
2B. [The least Round Way(DP) ](./cf/ .txt)
29D. Ant on the Tree (Tree + LCA + Brute Force)
371E. Subway Innovation (Prefix Sum+Math)
1438C. Engineer Artem
791D. Bear and Tree Jumps (Tree DP)
1178F1. Short Colorful Strip (Interval DP)
CodeForce 高分精算
23C. Oranges and Apples (2500) Greedy
324D. Xenia and Dominoes (2100) DP+容斥原理
383C. Propagating tree (DIV 1) (2000) 树状区间线段树
757C. Felicity is Coming! (1900)
776D. The Door Problem (2000) 2 SAT + SCC
803C. Maximal GCD (1900) (Math)
1031D. Minimum Path (1900) (Do + Greedy)
1062D. Fun with Integers (DIV 2) (1800) Graph
1392D. Omkar and Bed Wars (Global) (1700) DP
1392F. Omkar and Landslide (Global) (2400) Math+observation
1423B. Valuable Paper (1900) binary search+Bipartile Match+HopcroftKarp
1423J. Bubble Cup hypothesis (2400) dp
1428E. Carrots for Rabbits (2200) pq+greedy
1428F. Fruit Sequence(2400) Math+Monoti Stack
1428G1. G1 - Lucky Numbers (Easy Version)(2900) 0-k knapsack to 0-1 knapsack
1435C. Perform Easily (1900) Sort+Greedy+Sliding Window
1435D. Shurikens (1700) 贪心好题
1435E. Solo mid Oracle (2100) Math
1436D. Bandit in a City (1900) Tree+Greedy
1436E. Complicated Computations (2400) Segment Tree+Thinking
1437C. Chef Monocarp (1800) DP
1437E. Make It Increasing(2200) DP+LIS+Binary Search
1437F. Emotional Fishermen(2600) DP+Combination
1442A. Extreme Subtraction(1800) Greedy
1442B. Identify the Operations (1800) Math+Observation+Dara Structure
311E. Biologist (MIN CUT) (2300)
参考
- 最大权闭合子图 (https://www.cnblogs.com/TreeDream/p/5942354.html#_labelTop) (强顶)
证明 1: https://blog.csdn.net/yo_bc/article/details/75322370
证明 2: https://www.cnblogs.com/dilthey/p/7565206.html - 2-SAT Template:
https://github.com/JunBinLiang/Competitive-Coding/blob/master/2-SAT.cpp
https://cp-algorithms.com/graph/2SAT.html#toc-tgt-2