Skip to content

Latest commit

 

History

History
120 lines (94 loc) · 2.4 KB

README.md

File metadata and controls

120 lines (94 loc) · 2.4 KB

LeetCode Solutions Python

A collection of my Python LeetCode solutions organized by data structures, algorithms, and problem-solving patterns.

This repository is maintained as a personal learning resource to improve my understanding of Data Structures and Algorithms and to prepare for technical interviews.

Repository Structure

The solutions are organized into folders based on their primary data structure or problem-solving pattern.

leetcode-solutions-python/
│
├── Backtracking/
├── Binary Search/
├── DP/
├── Graph/
├── Greedy/
├── Linked List/
├── Math/
├── Prefix Sum/
├── Queue/
├── Sliding Window/
├── Sorting/
├── Stack/
├── Tree/
├── Two Pointers/
│
└── README.md

Topics Covered

Currently, this repository contains solutions for the following topics:

  • Backtracking
  • Binary Search
  • Dynamic Programming
  • Graph
  • Greedy
  • Linked List
  • Math
  • Prefix Sum
  • Queue
  • Sliding Window
  • Sorting
  • Stack
  • Tree
  • Two Pointers

More topics and solutions will be added over time.

File Naming Convention

Each solution is stored using the following naming format:

<problem-number>.<problem-title>.py

Examples:

1248.Count_Number_of_Nice_Subarrays.py
1525.Number_of_Good_Ways_to_Split_a_String.py

Spaces in problem titles are replaced with underscores.

Code Format

Every solution generally follows this documentation format:

"""
LeetCode: <problem-number> - <problem-title>
Link: <problem-link>
Difficulty: <Easy/Medium/Hard>
Time: <time-complexity>
Space: <space-complexity>
"""

Example:

"""
LeetCode: 1525 - Number of Good Ways to Split a String
Link: https://leetcode.com/problems/number-of-good-ways-to-split-a-string/
Difficulty: Medium
Time: O(n), where n is the size of the input string
Space: O(1), additional space excluding output
"""

Problem-Solving Patterns

The solutions in this repository use common techniques such as:

  • Backtracking
  • Binary Search
  • Breadth-First Search (BFS)
  • Depth-First Search (DFS)
  • Dynamic Programming
  • Prefix Sum
  • Sliding Window
  • Two Pointers
  • Greedy
  • Sorting
  • Stack-Based Techniques
  • Queue-Based Techniques
  • Tree Traversals
  • Graph Traversals

Author

Mayank Jeet