Skip to content

CypherKingdom/Leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode Solutions

This repository contains my solutions to various LeetCode problems implemented in C++ and Python.

Repository Structure

The repository is organized as follows:

  • Each problem solution is contained in a single file named probX.cpp or probX.py, where X is the problem number
  • Solutions include detailed problem descriptions, examples, and constraints
  • Code is well-commented with explanations of the algorithms and approaches used
  • Multiple solution approaches are provided where applicable

Problems Solved

Statistics

  • Total Problems: 37
  • C++ Solutions: 12
  • Python Solutions: 25
  • Easy: 34 problems
  • Medium: 2 problems
  • Hard: 1 problem

Problem List

# Difficulty Problem Language Solution
1 Easy Two Sum C++ prob1.cpp
2 Medium Add Two Numbers C++ prob2.cpp
3 Medium Longest Substring Without Repeating Characters C++ prob3.cpp
4 Hard Median of Two Sorted Arrays C++ prob4.cpp
5 Medium Longest Palindromic Substring C++ prob5.cpp
9 Easy Palindrome Number C++ prob9.cpp
13 Easy Roman to Integer C++ prob13.cpp
14 Easy Longest Common Prefix C++ prob14.cpp
20 Easy Valid Parentheses Python prob20.py
21 Easy Merge Two Sorted Lists C++ prob21.cpp
26 Easy Remove Duplicates from Sorted Array Python prob26.py
27 Easy Remove Element Python prob27.py
28 Easy Find the Index of the First Occurrence in a String Python prob28.py
35 Easy Search Insert Position Python prob35.py
58 Easy Length of Last Word Python prob58.py
66 Easy Plus One Python prob66.py
67 Easy Add Binary Python prob67.py
69 Easy Sqrt(x) Python prob69.py
70 Easy Climbing Stairs Python prob70.py
83 Easy Remove Duplicates from Sorted List Python prob83.py
88 Easy Merge Sorted Array C++ prob88.cpp
94 Easy Binary Tree Inorder Traversal Python prob94.py
100 Easy Same Tree Python prob100.py
101 Easy Symmetric Tree Python prob101.py
104 Easy Maximum Depth of Binary Tree Python prob104.py
108 Easy Convert Sorted Array to Binary Search Tree Python prob108.py
110 Easy Balanced Binary Tree Python prob110.py
111 Easy Minimum Depth of Binary Tree Python prob111.py
112 Easy Path Sum Python prob112.py
118 Easy Pascal's Triangle Python prob118.py
119 Easy Pascal's Triangle II Python prob119.py
121 Easy Best Time to Buy and Sell Stock Python prob121.py
125 Easy Valid Palindrome Python prob125.py
136 Easy Single Number Python prob136.py
175 Easy Combine Two Tables Python prob175.py
176 Easy Second Highest Salary Python prob176.py
177 Easy Nth Highest Salary Python prob177.py
178 Easy Rank Scores Python prob178.py
386 Medium Lexicographical Numbers C++ prob386.cpp
632 Hard Smallest Range Covering Elements from K Lists C++ prob632.cpp

Technologies Used

  • C++: Core algorithms, data structures, and system-level optimizations
  • Python: Rapid prototyping, clean and readable solutions
  • Git: Version control and project management

Setup and Execution

Prerequisites

  • For C++ solutions:
    • C++ compiler (GCC or Clang recommended)
    • C++11 or later standard support
  • For Python solutions:
    • Python 3.x interpreter
  • Optional: Visual Studio Code or any preferred IDE

Running C++ Solutions

# Navigate to the repository
cd /path/to/Leetcode

# Compile a specific C++ solution (using GCC)
g++ -g probX.cpp -o probX

# Run the solution
./probX

Running Python Solutions

# Navigate to the repository
cd /path/to/Leetcode

# Run a specific Python solution
python3 probX.py

# Or with explicit Python version
python probX.py

Code Structure

Each solution file typically includes:

  1. Problem description with LeetCode URL reference
  2. Difficulty level (Easy/Medium/Hard)
  3. Detailed algorithm explanation and approach analysis
  4. Time and space complexity comments
  5. Multiple solution implementations (where applicable)
  6. Well-commented code with clear variable names and logic flow

Problem Categories

Data Structures

  • Arrays and Strings
  • Linked Lists
  • Binary Trees
  • Hash Maps/Tables
  • Stacks

Algorithms

  • Two Pointers
  • Sliding Window
  • Dynamic Programming
  • Tree Traversal (DFS/BFS)
  • Binary Search
  • Sorting and Searching

Database (SQL)

  • Table Joins
  • Ranking Functions
  • Aggregation Queries

Learning Progress

This repository represents my journey through algorithmic problem-solving, showcasing:

  • Progressive difficulty: Starting with easy problems and advancing to harder challenges
  • Language diversity: Solutions in both C++ and Python to leverage each language's strengths
  • Multiple approaches: Different algorithms and optimizations for the same problem
  • Best practices: Clean, readable, and well-documented code

Contributing

Feel free to:

  • Suggest improvements or alternative solutions
  • Report bugs or issues
  • Propose optimizations
  • Add test cases

Submit contributions through issues or pull requests!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published