Policy-Based Data Structures (PBDS)
1358. Number of Substrings Containing All Three Characters.cpp
1910. Remove All Occurrences of a Substring.cpp
2452. Words Within Two Edits of Dictionary.cpp
2999. Count the Number of Powerful Integers.cpp
3461. Check If Digits Are Equal in String After Operations I.cpp
3503. Longest Palindrome After Substring Concatenation I.cpp
3517. Smallest Palindromic Rearrangement I.cpp
524. Longest Word in Dictionary through Deleting.cpp
748. Shortest Completing Word.cpp
1005. Maximize Sum Of Array After K Negations.cpp
1010. Pairs of Songs With Total Durations Divisible by 60.cpp
1014. Best Sightseeing Pair.cpp
1018. Binary Prefix Divisible By 5.cpp
1021. Remove Outermost Parentheses.cpp
1028. Recover a Tree From Preorder Traversal.cpp
1072. Flip Columns For Maximum Number of Equal Rows.cpp
1079. Letter Tile Possibilities.cpp
1091. Shortest Path in Binary Matrix.cpp
1106. Parsing A Boolean Expression.cpp
1123. Lowest Common Ancestor of Deepest Leaves.cpp
1161. Maximum Level Sum of a Binary Tree (BSF).cpp
1233. Remove Sub-Folders from the Filesystem.cpp
1261. Find Elements in a Contaminated Binary Tree.cpp
1267. Count Servers that Communicate.cpp
128. Longest Consecutive Sequence.cpp
1282. Group the People Given the Group Size They Belong To.cpp
1286. Iterator for Combination.cpp
1310. XOR Queries of a Subarray.cpp
1310. XOR Queries of a Subarray.py
1318. Minimum Flips to Make a OR b Equal to c.cpp
1331. Rank Transform of an Array.cpp
1331. Rank Transform of an Array.py
1346. Check If N and Its Double Exist.cpp
1346. Check If N and Its Double Exist.py
1352. Product of the Last K Numbers.cpp
1358. Number of Substrings Containing All Three Characters.cpp
1367. Linked List in Binary Tree.cpp
1367. Linked List in Binary Tree.py
1368. Minimum Cost to Make at Least One Valid Path in a Grid.cpp
1371. Find the Longest Substring Containing Vowels in Even Counts.cpp
1371. Find the Longest Substring Containing Vowels in Even Counts.py
1387. Sort Integers by The Power Value.cpp
1399. Count Largest Group.cpp
1399. Count Largest Group.py
1400. Construct K Palindrome Strings.cpp
1408. String Matching in an Array.cpp
1415. The k-th Lexicographical String of All Happy Strings of Length n.cpp
1422. Maximum Score After Splitting a String.cpp
1422. Maximum Score After Splitting a String.py
145. Binary Tree Postorder Traversal.cpp
1462. Course Schedule IV.cpp
1475. Final Prices With a Special Discount in a Shop.cpp
1475. Final Prices With a Special Discount in a Shop.py
1497. Check If Array Pairs Are Divisible by k.cpp
1497. Check If Array Pairs Are Divisible by k.py
1513. Number of Substrings With Only 1s.cpp
1514. Path with Maximum Probability.cpp
1514. Path with Maximum Probability.py
1524. Number of Sub-arrays With Odd Sum.cpp
1534. Count Good Triplets.cpp
1534. Count Good Triplets.py
1545. Find Kth Bit in Nth Binary String.cpp
1545. Find Kth Bit in Nth Binary String.py
1556. Thousand Separator.cpp
1590. Make Sum Divisible by P.cpp
1593. Split a String Into the Max Number of Unique Substrings.cpp
16. 3Sum Closest copy.cpp
1608. Special Array With X Elements Greater Than or Equal X.cpp
1639. Number of Ways to Form a Target String Given a Dictionary.cpp
1641. Count Sorted Vowel Strings.cpp
1652. Defuse the Bomb.cpp
1679. Max Number of K-Sum Pairs.cpp
1679. Max Number of K-Sum Pairs.py
1684. Count the Number of Consistent Strings.cpp
1684. Count the Number of Consistent Strings.py
1688. Count of Matches in Tournament.cpp
1695. Maximum Erasure Value.cpp
1711. Count Good Meals.cpp
1716. Calculate Money in Leetcode Bank.cpp
1718. Construct the Lexicographically Largest Valid Sequence.cpp
1726. Tuple with Same Product.cpp
1726. Tuple with Same Product.py
1742. Maximum Number of Balls in a Box.cpp
1749. Maximum Absolute Sum of Any Subarray.cpp
1752. Check if Array Is Sorted and Rotated.cpp
1752. Check if Array Is Sorted and Rotated.py
1759. Count Number of Homogenous Substrings.cpp
1760. Minimum Limit of Balls in a Bag.cpp
1760. Minimum Limit of Balls in a Bag.py
1765. Map of Highest Peak.cpp
1769. Minimum Number of Operations to Move All Balls to Each Box.cpp
1769. Minimum Number of Operations to Move All Balls to Each Box.js
1769. Minimum Number of Operations to Move All Balls to Each Box.py
1780. Check if Number is a Sum of Powers of Three.cpp
1784. Check if Binary String Has at Most One Segment of Ones.cpp
1790. Check if One String Swap Can Make Strings Equal.cpp
1792. Maximum Average Pass Ratio.cpp
1800. Maximum Ascending Subarray Sum.cpp
1829. Maximum XOR for Each Query.cpp
1837. Sum of Digits in Base K.cpp
1861. Rotating the Box.cpp
1863. Sum of All Subset XOR Totals.cpp
1865. Finding Pairs With a Certain Sum(Optimized).cpp
1865. Finding Pairs With a Certain Sum.cpp
1869. Longer Contiguous Segments of Ones than Zeros.cpp
1894. Find the Student that Will Replace the Chalk.cpp
1894. Find the Student that Will Replace the Chalk.js
1894. Find the Student that Will Replace the Chalk.py
1905. Count Sub Islands.cpp
1905. Count Sub Islands.py
1910. Remove All Occurrences of a Substring.cpp
1922. Count Good Numbers.py
1930. Unique Length-3 Palindromic Subsequences.cpp
1945. Sum of Digits of String After Convert.cpp
1945. Sum of Digits of String After Convert.py
1957. Delete Characters to Make Fancy String.cpp
1957. Delete Characters to Make Fancy String.py
1962. Remove Stones to Minimize the Total.cpp
1963. Minimum Number of Swaps to Make the String Balanced.cpp
1963. Minimum Number of Swaps to Make the String Balanced.py
1975. Maximum Matrix Sum.cpp
1976. Number of Ways to Arrive at Destination.cpp
1980. Find Unique Binary String.cpp
1980. Find Unique Binary String.py
1984. Minimum Difference Between Highest and Lowest of K Scores.cpp
1995. Count Special Quadruplets.cpp
2022. Convert 1D Array Into 2D Array.cpp
2022. Convert 1D Array Into 2D Array.py
2028. Find Missing Observations.cpp
2028. Find Missing Observations.py
2033. Minimum Operations to Make a Uni-Value Grid.cpp
2043. Simple Bank System.cpp
2044. Count Number of Maximum Bitwise-OR Subsets.cpp
2054. Two Best Non-Overlapping Events.cpp
2064. Minimized Maximum of Products Distributed to Any Store.cpp
2070. Most Beautiful Item for Each Query.cpp
2091. Removing Minimum and Maximum From Array.cpp
2094. Finding 3-Digit Even Numbers.cpp
2097. Valid Arrangement of Pairs.cpp
2099. Find Subsequence of Length K With the Largest Sum.cpp
2109. Adding Spaces to a String.cpp
2109. Adding Spaces to a String.py
211. Design Add and Search Words Data Structure.cpp
2115. Find All Possible Recipes from Given Supplies.cpp
2116. Check if a Parentheses String Can Be Valid.cpp
2119. A Number After a Double Reversal.cpp
2127. Maximum Employees to Be Invited to a Meeting.cpp
2139. Minimum Moves to Reach Target Score.cpp
214. Shortest Palindrome.cpp
214. Shortest Palindrome.py
2140. Solving Questions With Brainpower.cpp
2145. Count the Hidden Sequences.cpp
2161. Partition Array According to Given Pivot.cpp
2161. Partition Array According to Given Pivot.py
2176. Count Equal and Divisible Pairs in an Array.cpp
2176. Count Equal and Divisible Pairs in an Array.py
2177. Find Three Consecutive Integers That Sum to a Given Number.cpp
2177. Find Three Consecutive Integers That Sum to a Given Number.js
2177. Find Three Consecutive Integers That Sum to a Given Number.py
2179. Count Good Triplets in an Array.cpp
2182. Construct String With Repeat Limit using Map.cpp
2185. Counting Words With a Given Prefix.cpp
2185. Counting Words With a Given Prefix.py
2195. Append K Integers With Minimal Sum.cpp
2206. Divide Array Into Equal Pairs.cpp
2207. Maximize Number of Subsequences in a String.cpp
2208. Minimum Operations to Halve Array Sum.cpp
2210. Count Hills and Valleys in an Array.cpp
2220. Minimum Bit Flips to Convert Number.cpp
2220. Minimum Bit Flips to Convert Number.js
2220. Minimum Bit Flips to Convert Number.py
2221. Find Triangular Sum of an Array.cpp
2226. Maximum Candies Allocated to K Children.cpp
2255. Count Prefixes of a Given String.cpp
2257. Count Unguarded Cells in the Grid.cpp
2260. Minimum Consecutive Cards to Pick Up.cpp
2265. Count Nodes Equal to Average of Subtree.cpp
2275. Largest Combination With Bitwise AND Greater Than Zero.cpp
2279. Maximum Bags With Full Capacity of Rocks.cpp
2284. Sender With Largest Word Count.cpp
2290. Minimum Obstacle Removal to Reach Corner.cpp
2315. Count Asterisks.cpp
2317. Maximum XOR After Operations .cpp
2326. Spiral Matrix IV.cpp
2337. Move Pieces to Obtain a String.cpp
2338. Count the Number of Ideal Arrays.cpp
2342. Max Sum of a Pair With Equal Sum of Digits.cpp
2342. Max Sum of a Pair With Equal Sum of Digits.py
2349. Design a Number Container System.cpp
2364. Count Number of Bad Pairs.cpp
2375. Construct Smallest Number From DI String.cpp
2379. Minimum Recolors to Get K Consecutive Black Blocks.cpp
2379. Minimum Recolors to Get K Consecutive Black Blocks.js
2379. Minimum Recolors to Get K Consecutive Black Blocks.py
2381. Shifting Letters II.cpp
2401. Longest Nice Subarray.cpp
2414. Length of the Longest Alphabetical Continuous Substring.cpp
2414. Length of the Longest Alphabetical Continuous Substring.js
2414. Length of the Longest Alphabetical Continuous Substring.py
2415. Reverse Odd Levels of Binary Tree.cpp
2415. Reverse Odd Levels of Binary Tree.py
2416. Sum of Prefix Scores of Strings.cpp
2416. Sum of Prefix Scores of Strings.py
2419. Longest Subarray With Maximum Bitwise AND.cpp
2419. Longest Subarray With Maximum Bitwise AND.js
2419. Longest Subarray With Maximum Bitwise AND.py
2425. Bitwise XOR of All Pairings.cpp
2433. Find The Original Array of Prefix Xor.cpp
2433. Find The Original Array of Prefix Xor.py
2452. Words Within Two Edits of Dictionary.cpp
2455. Average Value of Even Numbers That Are Divisible by Three.cpp
2458. Height of Binary Tree After Subtree Removal Queries.cpp
2460. Apply Operations to an Array.cpp
2460. Apply Operations to an Array.py
2463. Minimum Total Distance Traveled.cpp
2466. Count Ways To Build Good Strings.cpp
2467. Most Profitable Path in a Tree.cpp
2471. Minimum Number of Operations to Sort a Binary Tree by Level.cpp
2471. Minimum Number of Operations to Sort a Binary Tree by Level.py
2476. Closest Nodes Queries in a Binary Search Tree.cpp
2481. Minimum Cuts to Divide a Circle.cpp
2490. Circular Sentence.cpp
2491. Divide Players Into Teams of Equal Skill.cpp
2491. Divide Players Into Teams of Equal Skill.py
2503. Maximum Number of Points From Grid Queries.cpp
2512. Reward Top K Students.cpp
2516. Take K of Each Character From Left and Right.cpp
2523. Closest Prime Numbers in Range.cpp
2523. Closest Prime Numbers in Range.py
2529. Maximum Count of Positive Integer and Negative Integer.cpp
2530. Maximal Score After Applying K Operations.cpp
2537. Count the Number of Good Subarrays.cpp
2551. Put Marbles in Bags.cpp
2554. Maximum Number of Integers to Choose From a Range I.cpp
2554. Maximum Number of Integers to Choose From a Range I.py
2558. Take Gifts From the Richest Pile.cpp
2558. Take Gifts From the Richest Pile.py
2559. Count Vowel Strings in Ranges.cpp
2559. Count Vowel Strings in Ranges.py
2560. House Robber IV.cpp
2563. Count the Number of Fair Pairs.cpp
2563. Count the Number of Fair Pairs.py
2568. Minimum Impossible OR.cpp
2570. Merge Two 2D Arrays by Summing Values.cpp
2570. Merge Two 2D Arrays by Summing Values.py
2577. Minimum Time to Visit a Cell In a Grid.cpp
2579. Count Total Number of Colored Cells.cpp
2579. Count Total Number of Colored Cells.py
2583. Kth Largest Sum in a Binary Tree (BFS).cpp
2583. Kth Largest Sum in a Binary Tree (DFS).cpp
2593. Find Score of an Array After Marking All Elements.cpp
2594. Minimum Time to Repair Cars.cpp
2601. Prime Subtraction Operation.cpp
2609. Find the Longest Balanced Substring of a Binary String.cpp
2641. Cousins in Binary Tree II (BSF).cpp
2657. Find the Prefix Common Array of Two Arrays.cpp
2658. Maximum Number of Fish in a Grid.cpp
2661. First Completely Painted Row or Column.cpp
2683. Neighboring Bitwise XOR.cpp
2683. Neighboring Bitwise XOR.py
2684. Maximum Number of Moves in a Grid.cpp
2685. Count the Number of Complete Components.cpp
2696. Minimum String Length After Removing Substrings.cpp
2698. Find the Punishment Number of an Integer.cpp
2762. Continuous Subarrays.cpp
2769. Find the Maximum Achievable Number.cpp
2779. Maximum Beauty of an Array After Applying Operation.cpp
2788. Split Strings by Separator.cpp
2799. Count Complete Subarrays in an Array.cpp
2799. Count Complete Subarrays in an Array.py
2807. Insert Greatest Common Divisors in Linked List.cpp
2807. Insert Greatest Common Divisors in Linked List.py
2815. Max Pair Sum in an Array.cpp
2818. Apply Operations to Maximize Score.cpp
2825. Make String a Subsequence Using Cyclic Increments.cpp
2825. Make String a Subsequence Using Cyclic Increments.py
2843. Count Symmetric Integers.cpp
2872. Maximum Number of K-Divisible Components.cpp
2873. Maximum Value of an Ordered Triplet I.cpp
2874. Maximum Value of an Ordered Triplet II.cpp
2908. Minimum Sum of Mountain Triplets I.cpp
2909. Minimum Sum of Mountain Triplets II.cpp
2913. Subarrays Distinct Element Sum of Squares I.cpp
2914. Minimum Number of Changes to Make Binary String Beautiful.cpp
2914. Minimum Number of Changes to Make Binary String Beautiful.py
2932. Maximum Strong Pair XOR I.cpp
2937. Make Three Strings Equal.cpp
2938. Separate Black and White Balls.cpp
2938. Separate Black and White Balls.py
2940. Find Building Where Alice and Bob Can Meet.cpp
2948. Make Lexicographically Smallest Array by Swapping Elements.cpp
2957. Remove Adjacent Almost-Equal Characters.cpp
2960. Count Tested Devices After Test Operations.cpp
2965. Find Missing and Repeated Values.cpp
2965. Find Missing and Repeated Values.py
2981. Find Longest Special Substring That Occurs Thrice I.cpp
2999. Count the Number of Powerful Integers.cpp
3011. Find if Array Can Be Sorted.cpp
303. Range Sum Query - Immutable.cpp
3038. Maximum Number of Operations With the Same Score I.cpp
3042. Count Prefix and Suffix Pairs I.cpp
3043. Find the Length of the Longest Common Prefix.cpp
3043. Find the Length of the Longest Common Prefix.py
3066. Minimum Operations to Exceed Threshold Value II.cpp
3066. Minimum Operations to Exceed Threshold Value II.py
3097. Shortest Subarray With OR at Least K II.cpp
3105. Longest Strictly Increasing or Strictly Decreasing Subarray.cpp
3105. Longest Strictly Increasing or Strictly Decreasing Subarray.py
3107. Minimum Operations to Make Median of Array Equal to K.cpp
3107. Minimum Operations to Make Median of Array Equal to K.js
3107. Minimum Operations to Make Median of Array Equal to K.py
3108. Minimum Cost Walk in Weighted Graph.cpp
3133. Minimum Array End.cpp
3151. Special Array I.cpp
3152. Special Array II.cpp
3152. Special Array II.py
3158. Find the XOR of Numbers Which Appear Twice.cpp
3160. Find the Number of Distinct Colors Among the Balls.cpp
3163. String Compression III.cpp
3163. String Compression III.py
3169. Count Days Without Meetings.cpp
3169. Count Days Without Meetings.py
318. Maximum Product of Word Lengths.cpp
3191. Minimum Operations to Make Binary Array Elements Equal to One I.cpp
3191. Minimum Operations to Make Binary Array Elements Equal to One I.js
3191. Minimum Operations to Make Binary Array Elements Equal to One I.py
3203. Find Minimum Diameter After Merging Two Trees.cpp
3208. Alternating Groups II.cpp
3208. Alternating Groups II.py
3217. Delete Nodes From Linked List Present in Array.cpp
3223. Minimum Length of String After Operations.cpp
3223. Minimum Length of String After Operations.py
3243. Shortest Distance After Road Addition Queries I.cpp
3255. Find the Power of K-Size Subarrays.cpp
3255. Find the Power of K-Size Subarrays.js
3255. Find the Power of K-Size Subarrays.py
3258. Count Substrings That Satisfy K-Constraint I.cpp
3264. Final Array State After K Multiplication Operations I.cpp
3264. Final Array State After K Multiplication Operations I.py
3270. Find the Key of the Numbers.cpp
3270. Find the Key of the Numbers.py
3271. Hash Divided String.cpp
3271. Hash Divided String.py
3272. Find the Count of Good Integers.cpp
3274. Check if Two Chessboard Squares Have the Same Color.cpp
3274. Check if Two Chessboard Squares Have the Same Color.py
3280. Convert Date to Binary.cpp
3282. Reach End of Array With Max Score.cpp
3289. The Two Sneaky Numbers of Digitville.cpp
3304. Find the K-th Character in String Game I.cpp
3306. Count of Substrings Containing Every Vowel and K Consonants II.cpp
3309. Maximum Possible Number by Binary Concatenation.cpp
3324. Find the Sequence of Strings Appeared on the Screen.cpp
3330. Find the Original Typed String I.cpp
3340. Check Balanced String.cpp
3341. Find Minimum Time to Reach Last Room I.cpp
3345. Smallest Divisible Digit Product I.cpp
3356. Zero Array Transformation II.cpp
3370. Smallest Number With All Set Bits.cpp
3375. Minimum Operations to Make Array Values Equal to K.cpp
3394. Check if Grid can be Cut into Sections.py
3396. Minimum Number of Operations to Make Elements in Array Distinct.cpp
3396. Minimum Number of Operations to Make Elements in Array Distinct.py
3397. Maximum Number of Distinct Elements After Operations.cpp
3407. Substring Matching Pattern.cpp
3412. Find Mirror Score of a String.cpp
3432. Count Partitions with Even Sum Difference.cpp
3446. Sort Matrix by Diagonals.cpp
3461. Check If Digits Are Equal in String After Operations I.cpp
3467. Transform Array by Parity.cpp
3477. Fruits Into Baskets II.cpp
3492. Maximum Containers on a Ship.cpp
3503. Longest Palindrome After Substring Concatenation I.cpp
3512. Minimum Operations to Make Array Sum Divisible by K.cpp
3512. Minimum Operations to Make Array Sum Divisible by K.py
3516. Find Closest Person.cpp
3517. Smallest Palindromic Rearrangement I.cpp
368. Largest Divisible Subset.cpp
386. Lexicographical Numbers.cpp
386. Lexicographical Numbers.py
407. Trapping Rain Water II.cpp
416. Partition Equal Subset Sum(Bottom Up).cpp
416. Partition Equal Subset Sum(Recursion).cpp
416. Partition Equal Subset Sum(Recursion).py
432. All O`one Data Structure.cpp
476. Number Complement.cpp
515. Find Largest Value in Each Tree Row.cpp
515. Find Largest Value in Each Tree Row.py
524. Longest Word in Dictionary through Deleting.cpp
539. Minimum Time Difference.cpp
539. Minimum Time Difference.py
567. Permutation in String.cpp
567. Permutation in String.py
590. N-ary Tree Postorder Traversal.cpp
632. Smallest Range Covering Elements from K Lists.py
641. Design Circular Deque.cpp
641. Design Circular Deque.py
646. Maximum Length of Pair Chain.cpp
655. Print Binary Tree.cpp
658. Find K Closest Elements.cpp
676. Implement Magic Dictionary.cpp
684. Redundant Connection.cpp
703. Kth Largest Element in a Stream.cpp
725. Split Linked List in Parts.cpp
74. Search a 2D Matrix.cpp
748. Shortest Completing Word.cpp
762. Prime Number of Set Bits in Binary Representation.cpp
763. Partition Labels.cpp
767. Reorganize String.cpp
769. Max Chunks To Make Sorted.cpp
775. Global and Local Inversions.py
781. Rabbits in Forest.cpp
781. Rabbits in Forest.py
80. Remove Duplicates from Sorted Array II.cpp
802. Find Eventual Safe States.cpp
827. Making A Large Island.cpp
862. Shortest Subarray with Sum at Least K.cpp
873. Length of Longest Fibonacci Subsequence.cpp
874. Walking Robot Simulation.cpp
884. Uncommon Words from Two Sentences.cpp
884. Uncommon Words from Two Sentences.py
914. X of a Kind in a Deck of Cards.cpp
915. Partition Array into Disjoint Intervals.cpp
921. Minimum Add to Make Parentheses Valid.cpp
921. Minimum Add to Make Parentheses Valid.py
925. Long Pressed Name.cpp
951. Flip Equivalent Binary Trees (BFS).cpp
951. Flip Equivalent Binary Trees (DSF).cpp
962. Maximum Width Ramp.cpp
983. Minimum Cost For Tickets.cpp
989. Add to Array-Form of Integer.cpp
993. Cousins in Binary Tree (DFS).cpp
Folders and files Name Name Last commit message
Last commit date
parent directory Mar 11, 2025
Feb 11, 2025
Apr 10, 2025
Apr 10, 2025
Feb 10, 2025
Feb 10, 2025
Feb 23, 2025
Mar 31, 2025
Apr 13, 2025
Apr 24, 2025
Jan 22, 2025
Apr 6, 2025
View all files
You can’t perform that action at this time.