A comprehensive collection of algorithmic templates, data structures, and problem solutions for competitive programming and technical interviews.
AdvancedTechniques.py- Mo's Algorithm, advanced optimization techniquesAdvancedDSA.py- Segment Trees with Lazy Propagation, advanced data structuresDp.py- Dynamic Programming patterns including TSP, Digit DP, and Bitmask DPGraph.py- Graph algorithms (Dijkstra, Floyd-Warshall, 0-1 BFS, etc.)String.py- String algorithms including KMP, pattern matchingSlidingWindow.py- Sliding window techniques and patterns
mySolutions/- Directory containing solutions to specific LeetCode problems- Find Edges in Shortest Paths
- Maximize Subarray Sum After Removing All Occurrences of One Element
- Number of Distinct Roll Sequences
- Paint House III
- Swim in Rising Water
- Lazy Propagation Segment Tree - Efficient range updates and queries
- Mo's Algorithm - Square root decomposition for offline queries
- Graph Algorithms - Complete implementation of shortest path algorithms
- Bitmask DP - Traveling Salesman Problem (TSP) variations
- Digit DP - Count numbers with specific properties
- Set Cover Problems - Minimum actions to cover all positions
- KMP Algorithm - Efficient pattern matching
- Advanced String Processing - Multiple string manipulation techniques
- Dijkstra's Algorithm - Single-source shortest path
- Floyd-Warshall - All-pairs shortest path
- 0-1 BFS - Specialized BFS for binary weights
Each Python file contains well-documented classes and functions that can be directly imported and used:
from AdvancedDSA import LazySegTree
from Graph import Solution as GraphSolution
from Dp import Solution as DPSolution
# Example: Using Lazy Segment Tree
arr = [1, 2, 3, 4, 5]
seg_tree = LazySegTree(arr)
seg_tree.range_add(0, 2, 10) # Add 10 to range [0, 2]
result = seg_tree.range_sum(1, 3) # Query sum in range [1, 3]
# Example: Using Dijkstra's algorithm
graph_solver = GraphSolution()
edges = [(0, 1, 2), (1, 2, 3), (0, 2, 6)]
distances = graph_solver.dijkstra(3, edges, 0)- Competitive Programmers preparing for contests like Codeforces, AtCoder
- Software Engineers preparing for technical interviews at FAANG companies
- Students learning advanced algorithms and data structures
- Anyone looking to improve their problem-solving skills
- Shortest Path Algorithms
- Graph Traversal Techniques
- Specialized BFS/DFS variants
- Classical DP patterns
- Optimization techniques
- State space reduction methods
=======
- travelling salesmen problem
- Range Query Data Structures
- Efficient Update Mechanisms
- Square Root Decomposition
- Pattern Matching
- String Hashing
- Advanced String Algorithms
- Python 3.7+
- Basic understanding of algorithms and data structures
- Familiarity with competitive programming concepts
Feel free to contribute by:
- Adding new algorithm templates
- Optimizing existing implementations
- Adding more problem solutions
- Improving documentation
This project is open source and available under the MIT License.
- LeetCode for providing an excellent platform for practicing algorithms
- The competitive programming community for sharing knowledge and techniques
| 3764-maximum-sum-with-at-most-k-elements |
| 4005-maximum-total-subarray-value-i |
| 0239-sliding-window-maximum |
| 1014-k-closest-points-to-origin |
| 1753-path-with-minimum-effort |
| 2099-find-subsequence-of-length-k-with-the-largest-sum |
| 3764-maximum-sum-with-at-most-k-elements |
| 0169-majority-element |
| 0190-reverse-bits |
| 1014-k-closest-points-to-origin |
| 0169-majority-element |
| 2442-count-number-of-distinct-integers-after-reverse-operations |
| 0054-spiral-matrix |
| 1929-concatenation-of-array |
| 2154-keep-multiplying-found-values-by-two |
| 0069-sqrtx |
| 0349-intersection-of-two-arrays |
| 0713-subarray-product-less-than-k |
| 1753-path-with-minimum-effort |
| 0239-sliding-window-maximum |
| 0713-subarray-product-less-than-k |
| 0940-fruit-into-baskets |
| 0713-subarray-product-less-than-k |
| 1833-find-the-highest-altitude |
| 0039-combination-sum |
| 0040-combination-sum-ii |
| 0090-subsets-ii |
| 0216-combination-sum-iii |
| 0009-palindrome-number |
| 0066-plus-one |
| 0069-sqrtx |
| 1014-k-closest-points-to-origin |
| 2442-count-number-of-distinct-integers-after-reverse-operations |
| 2443-sum-of-number-and-its-reverse |
| 0239-sliding-window-maximum |
| 0239-sliding-window-maximum |
| 0090-subsets-ii |
| 0190-reverse-bits |
| 0895-shortest-path-to-get-all-keys |
| 1018-binary-prefix-divisible-by-5 |
| 0200-number-of-islands |
| 0827-making-a-large-island |
| 1753-path-with-minimum-effort |
| 0776-n-ary-tree-postorder-traversal |
| 0116-populating-next-right-pointers-in-each-node |
| 0230-kth-smallest-element-in-a-bst |
| 0538-convert-bst-to-greater-tree |
| 0799-minimum-distance-between-bst-nodes |
| 1014-k-closest-points-to-origin |
| 1014-k-closest-points-to-origin |
| 0349-intersection-of-two-arrays |
| 0922-sort-array-by-parity-ii |
| 1861-rotating-the-box |
| 2441-largest-positive-integer-that-exists-with-its-negative |
| 2443-sum-of-number-and-its-reverse |