Welcome to my repository of solutions to the problems from the CSES Problem Set. This repository contains my implementations of the challenges, written in a clean and structured way to help others understand and learn.
The CSES Problem Set is a collection of competitive programming problems designed to test and enhance problem-solving skills. It is widely recognized as a valuable resource for aspiring competitive programmers.
38 Problems solved out of 300
The solutions are organized into directories based on the problem categories available on the CSES platform:
📁 Introductory Problems
- ✔ Weird Algorithm
- ✔ Missing Number
- ✔ Repetitions
- ✔ Increasing Array
- ✔ Permutations
- ✔ Number Spiral
- ✔ Two Knights
- ✔ Two Sets
- ✔ Bit Strings
- ✔ Trailing Zeros
- ✔ Coin Piles
- ✔ Palindrome Reorder
- ✔ Gray Code
- ❔ Tower of Hanoi
- ✔ Creating Strings
- ✔ Apple Division
- ✔ Chessboard and Queens
- ✔ Digit Queries
- ❔ Grid Paths
📁 Sorting and Searching
- ✔ Distinct Numbers
- ✔ Apartments
- ✔ Ferris Wheel
- ✔ Concert Tickets
- ✔ Restaurant Customers
- ✔ Movie Festival
- ✔ Sum of Two Values
- ✔ Maximum Subarray Sum
- ✔ Stick Lengths
- ❔ Missing Coin Sum
- ✔ Collecting Numbers
- ❔ Collecting Numbers II
- ❔ Playlist
- ❔ Towers
- ❔ Traffic Lights
- ❔ Josephus Problem I
- ❔ Josephus Problem II
- ❔ Nested Ranges Check
- ❔ Nested Ranges Count
- ❔ Room Allocation
- ❔ Factory Machines
- ❔ Tasks and Deadlines
- ❔ Reading Books
- ❔ Sum of Three Values
- ❔ Sum of Four Values
- ❔ Nearest Smaller Values
- ❔ Subarray Sums I
- ❔ Subarray Sums II
- ❔ Subarray Divisibility
- ❔ Subarray Distinct Values
- ❔ Array Division
- ❔ Sliding Window Median
- ❔ Sliding Window Cost
- ❔ Movie Festival II
- ❔ Maximum Subarray Sum II
📁 Dynamic Programming
- ✔ Dice Combinations
- ✔ Minimizing Coins
- ✔ Coin Combinations I
- ❔ Coin Combinations II
- ❔ Removing Digits
- ❔ Grid Paths
- ❔ Book Shop
- ❔ Array Description
- ❔ Counting Towers
- ❔ Edit Distance
- ❔ Rectangle Cutting
- ❔ Money Sums
- ❔ Removal Game
- ❔ Two Sets II
- ❔ Increasing Subsequence
- ❔ Projects
- ❔ Elevator Rides
- ❔ Counting Tilings
- ❔ Counting Numbers
📁 Graph Algorithms
- ✔ Counting Rooms
- ✔ Labyrinth
- ✔ Building Roads
- ✔ Message Route
- ✔ Building Teams
- ✔ Round Trip
- ✔ Monsters
- ✔ Shortest Routes I
- ✔ Shortest Routes II
- ❔ High Score
- ❔ Flight Discount
- ❔ Cycle Finding
- ❔ Flight Routes
- ❔ Round Trip II
- ❔ Couse Schedule
- ❔ Longest Flight Route
- ❔ Game Routes
- ❔ Investigation
- ❔ Planets Queries I
- ❔ Planets Queries II
- ❔ Planets Cycles
- ❔ Road Reparation
- ❔ Road Construction
- ❔ Flight Routes Check
- ❔ Planets and Kingdoms
- ❔ Giant Pizza
- ❔ Coin Collector
- ❔ Mail Delivery
- ❔ De Bruijn Sequence
- ❔ Teleporters Path
- ❔ Hamiltonian Flights
- ❔ Knight's Tour
- ❔ Download Speed
- ❔ Police Chase
- ❔ School Dance
- ❔ Distinct Routes
📁 Range Queries
- ❔ Static Range Sum Queries
- ❔ Static Range Minimum Queries
- ❔ Dynamic Range Sum Queries
- ❔ Dynamid Range Minimum Queries
- ❔ Range Xor Queries
- ❔ Forest Queries
- ❔ Hotel Queries
- ❔ List Removals
- ❔ Salary Queries
- ❔ Prefix Sum Queries
- ❔ Pizzeria Queries
- ❔ Subarray Sum Queries
- ❔ Distinct Values Queries
- ❔ Increasing Array Queries
- ❔ Forest Queries II
- ❔ Range Updates and Sums
- ❔ Polynomial Queries
- ❔ Range Queries and Copies
📁 Tree Algorithms
- ❔ Subordinates
- ❔ Tree Matching
- ❔ Tree Diameter
- ❔ Tree Distances I
- ❔ Tree Distances II
- ❔ Company Queries I
- ❔ Company Queries II
- ❔ Distance Queries
- ❔ Counting Paths
- ❔ Subtree Queries
- ❔ Path Queries
- ❔ Path Queries II
- ❔ Distinct Colors
- ❔ Finding a Centroid
- ❔ Fixed-Lenght Paths I
- ❔ Fixed-Lenght Paths II
📁 Mathematics
- ❔ Josephus Queries
- ❔ Exponentiation
- ❔ Exponentiation II
- ❔ Counting Divisors
- ❔ Common Divisors
- ❔ Sum of Divisors
- ❔ Divisor Analysis
- ❔ Prime Multiples
- ❔ Counting Coprime Pairs
- ❔ Binomial Coefficients
- ❔ Creating Strings II
- ❔ Distributing Apples
- ❔ Christmas Party
- ❔ Bracket Sequences I
- ❔ Bracket Sequences II
- ❔ Counting Necklaces
- ❔ Counting Grids
- ❔ Fibonacci Numbers
- ❔ Throwing Dice
- ❔ Graph Paths I
- ❔ Graph Paths II
- ❔ Dice Probability
- ❔ Moving Robots
- ❔ Candy Lottery
- ❔ Inversion Probability
- ❔ Stick Game
- ❔ Nim Game I
- ❔ Nim Game II
- ❔ Stair Game
- ❔ Grundy's Game
- ❔ Another Game
📁 String Algorithms
- ❔ Word Combinations
- ❔ String Matching
- ❔ Finding Borders
- ❔ Finding Periods
- ❔ Minimal Rotation
- ❔ Longest Palindrome
- ❔ Required Substring
- ❔ Palindrome Queries
- ❔ Finding Patterns
- ❔ Counting Patterns
- ❔ Pattern Positions
- ❔ Distinct Substrings
- ❔ Repeating Substring
- ❔ String Functions
- ❔ Substring Order I
- ❔ Substring Order II
- ❔ Substring Distribution
📁 Geometry
- ❔ Point Location Test
- ❔ Line Segment Intersection
- ❔ Polygon Area
- ❔ Point in Polygon
- ❔ Polygon Lattice Points
- ❔ Minimum Euclidean Distance
- ❔ Convex Hull
📁 Advanced Techniques
- ❔ Meet in the Middle
- ❔ Hamming Distance
- ❔ Beautiful Subgrids
- ❔ Reachable Nodes
- ❔ Reachability Queries
- ❔ Cut and Paste
- ❔ Substring Reversals
- ❔ Reversals and Sums
- ❔ Necessary Roads
- ❔ Necessary Cities
- ❔ Eulerian Subgraphs
- ❔ Monster Game I
- ❔ Monster Game II
- ❔ Subarray Squares
- ❔ Houses and Schools
- ❔ Knuth Division
- ❔ Apples and Bananas
- ❔ One Bit Positions
- ❔ Signal Processing
- ❔ New Roads Queries
- ❔ Dynamic Connectivity
- ❔ Parcel Delivery
- ❔ Task Assignment
- ❔ Distinct Routes II
📁 Additional Problems
- ❔ Shortest Subsequence
- ❔ Counting Bits
- ❔ Swap Game
- ❔ Prüfer Code
- ❔ Acyclic Graph Edges
- ❔ Strongly Connected Edges
- ❔ Even Outdegree Edges
- ❔ Multiplication Table
- ❔ Advertisement
- ❔ Special Substrings
- ❔ Permutation Inversions
- ❔ Maximum Xor Subarray
- ❔ Movie Festival Queries
- ❔ Chess Tournament
- ❔ Tree Traversals
- ❔ Network Renovation
- ❔ Graph Girth
- ❔ Intersection Points
- ❔ Inverse Inversions
- ❔ Monotone Subsequences
- ❔ String Reorder
- ❔ Stack Weights
- ❔ Pyramid Array
- ❔ Increasing Subsequence II
- ❔ String Removals
- ❔ Bit Inversions
- ❔ Xor Pyramid
- ❔ Writing Numbers
- ❔ String Transform
- ❔ Letter Pair Move Game
- ❔ Maximum Building I
- ❔ Sorting Methods
- ❔ Cyclic Array
- ❔ List of Sums
- ❔ Increasing Array II
- ❔ Food Division
- ❔ Bit Problem
- ❔ Swap Round Sorting
- ❔ Binary Subsequences
- ❔ Tree Isomorphism I
- ❔ Counting Sequences
- ❔ Critical Cities
- ❔ School Excursion
- ❔ Coin Grid
- ❔ Robot Path
- ❔ Programmers and Artists
- ❔ Course Schedule II
- ❔ Removing Digits II
- ❔ Coin Arrangement
- ❔ Counting Bishops
- ❔ Grid Puzzle I
- ❔ Grid Puzzle II
- ❔ Empty String
- ❔ Grid Paths
- ❔ Bit Substrings
- ❔ Reversal Sorting
- ❔ Counting Reorders
- ❔ Book Shop II
- ❔ Network Breakdown
- ❔ Visiting Cities
- ❔ Missing Coin Sum Queries
- ❔ Number Grid
- ❔ Maximum Building II
- ❔ Filling Trominos
- ❔ Stick Divisions
- ❔ Coding Company
- ❔ Flight Route Requests
- ❔ Two Stacks Sorting
- ❔ Tree Isomorphism II
- ❔ Forbidden Cities
- ❔ Area of Rectangles
- ❔ Grid Completion
- ❔ Creating Offices
- ❔ Permutations II
- ❔ Functional Graph Distribution
- ❔ New Flight Routes
- ❔ Grid Path Construction
Each solution includes the code implementation.
- Programming Language: C++ (and sometimes Python)
- Editor/IDE: CodeBlocks
- Clone the repository:
git clone https://github.com/SebasKoria/CSES-Problem-Set---Solutions.git
- Navigate to the desired problem category.
- Open the relevant file to view the solution.
If you have any questions or suggestions, feel free to reach out to me via email.
🌟 Happy Coding! 🌟