Skip to content

Latest commit

 

History

History
232 lines (208 loc) · 16.8 KB

README.md

File metadata and controls

232 lines (208 loc) · 16.8 KB

Solutions for CSES Problem Set

There are solutions for the following CSES Problem Set problems, organized by problem categories:

Introductory Problems

  1. Weird Algorithm (Python) (problem site)
  2. Missing Number (Python, Ruby) (problem site)
  3. Repetitions (problem site)
  4. Increasing Array (problem site)
  5. Permutations (problem site)
  6. Number Spiral (problem site)
  7. Two Knights (Common Lisp) (problem site)
  8. Two Sets (problem site)
  9. Bit Strings (problem site)
  10. Trailing Zeros (problem site)
  11. Coin Piles (problem site)
  12. Palindrome Reorder (problem site)
  13. Gray Code (problem site)
  14. Tower of Hanoi (problem site)
  15. Creating Strings (problem site)
  16. Apple Division (problem site)
  17. Chessboard and Queens (problem site)
  18. Digit Queries (problem site)
  19. Grid Paths (problem site)

Sorting and Searching

  1. Distinct Numbers (problem site)
  2. Apartments (Python) (problem site)
  3. Ferris Wheel (problem site)
  4. Concert Tickets (problem site)
  5. Restaurant Customers (problem site)
  6. Movie Festival (problem site)
  7. Sum of Two Values (problem site)
  8. Maximum Subarray Sum (Python) (problem site)
  9. Stick Lengths (problem site)
  10. Missing Coin Sum (problem site)
  11. Collecting Numbers (problem site)
  12. Collecting Numbers II (problem site)
  13. Playlist (problem site)
  14. Towers (problem site)
  15. Traffic Lights (problem site)
  16. Josephus Problem I (problem site)
  17. Josephus Problem II (problem site)
  18. Nested Ranges Check (problem site)
  19. Nested Ranges Count (problem site)
  20. Room Allocation (problem site)
  21. Factory Machines (problem site)
  22. Task and Deadlines (problem site)
  23. Reading Books (problem site)
  24. Sum of Three Values (problem site)
  25. Sum of Four Values (problem site)
  26. Nearest Smaller Values (problem site)
  27. Subarray Sums I (problem site)
  28. Subarray Sums II (problem site)
  29. Subarray Divisibility (problem site)
  30. Subarray Distinct Values (problem site)
  31. Array Division (problem site)
  32. Sliding Median (problem site)
  33. Sliding Cost (problem site)
  34. Movie Festival II (problem site)
  35. Maximum Subarray Sum II (problem site)

Dynamic Programming

  1. Dice Combinations (problem site)
  2. Minimizing Coins (problem site)
  3. Coin Combinations I (problem site)
  4. Coin Combinations II (problem site)
  5. Removing Digits (problem site)
  6. Grid Paths (problem site)
  7. Book Shop (problem site)
  8. Array Description (problem site)
  9. Counting Towers (problem site)
  10. Edit Distance (problem site)
  11. Rectangle Cutting (problem site)
  12. Money Sums (problem site)
  13. Removal Game (problem site)
  14. Two Sets II (problem site)
  15. Increasing Subsequence (problem site)
  16. Projects (problem site)
  17. Elevator Rides (problem site)
  18. Counting Tilings (problem site)
  19. Couting Numbers (problem site)

Graph Algorithms

  1. Counting Rooms (problem site)
  2. Labyrinth (problem site)
  3. Building Roads (problem site)
  4. Message Route (problem site)
  5. Building Teams (problem site)
  6. Round Trip (problem site)
  7. Monsters (problem site)
  8. Shortest Routes I (problem site)
  9. Shortest Routes II (problem site)
  10. High Score (problem site)
  11. Flight Discount (problem site)
  12. Cycle Finding (problem site)
  13. Flight Routes (problem site)
  14. Round Trip II (problem site)
  15. Course Schedule (problem site)
  16. Longest Flight Route (problem site)
  17. Game Routes (problem site)
  18. Investigation (problem site)
  19. Planet Queries I (problem site)
  20. Planet Queries II (problem site)
  21. Planet Cycles (problem site)
  22. Road Reparation (problem site)
  23. Road Construction (problem site)
  24. Flight Routes Check (problem site)
  25. Planets and Kingdoms (problem site)
  26. Giant Pizza (problem site)
  27. Coin Collector (problem site)
  28. Mail Delivery (problem site)
  29. De Bruijn Sequence (problem site)
  30. Teleporters Path (problem site)
  31. Hamiltonian Flights (problem site)
  32. Knight's Tour (problem site)
  33. Download Speed (problem site)
  34. Police Chase (problem site)
  35. School Dance (problem site)
  36. Distinct Routes (problem site)

Range Queries

  1. Static Range Sum Queries (problem site)
  2. Static Range Minimum Queries (problem site)
  3. Dynamic Range Sum Queries (problem site)
  4. Dynamic Range Minimum Queries (problem site)
  5. Range Xor Queries (problem site)
  6. Range Update Queries (problem site)
  7. Forest Queries (problem site)
  8. Hotel Queries (problem site)
  9. List Removals (problem site)
  10. Salary Queries (problem site)
  11. Prefix Sum Queries (problem site)
  12. Pizzeria Queries (problem site)
  13. Subarray Sum Queries (problem site)
  14. Distinct Values Queries (problem site)
  15. Increasing Array Queries (problem site)
  16. Forest Queries II (problem site)
  17. Range Updates and Sums (problem site)
  18. Polynomial Queries (problem site)
  19. Range Queries and Copies (problem site)

Tree Algorithms

  1. Subordinates (problem site)
  2. Tree Matching (problem site)
  3. Tree Diameter (problem site)
  4. Tree Distances I (problem site)
  5. Tree Distances II (problem site)
  6. Company Queries I (problem site)
  7. Company Queries II (problem site)
  8. Distance Queries (problem site)
  9. Counting Paths (problem site)
  10. Subtree Queries (problem site)
  11. Path Queries (problem site)
  12. Path Queries II (problem site)
  13. Distinct Colors (problem site)
  14. Finding a Centroid (problem site)
  15. Fixed-Length Paths I (problem site)
  16. Fixed-Length Paths II (problem site)

Mathematics

  1. Josephus Queries (problem site)
  2. Exponentiation (problem site)
  3. Exponentiation II (problem site)
  4. Counting Divisors (problem site)
  5. Common Divisors (problem site)
  6. Sum of Divisors (problem site)
  7. Divisor Analysis (problem site)
  8. Prime Multiples (problem site)
  9. Counting Coprime Pairs (problem site)
  10. Binomial Coefficients (problem site)
  11. Creating Strings II (problem site)
  12. Distributing Apples (problem site)
  13. Christmas Party (problem site)
  14. Bracket Sequences I (problem site)
  15. Bracket Sequences II (problem site)
  16. Fibonacci Numbers (problem site)
  17. Throwing Dice (problem site)
  18. Nim Game II (problem site)
  19. Stair Game (problem site (hacked))

String Algorithms

  1. String Matching (problem site)
  2. Finding Borders (problem site)
  3. Minimal Rotation (problem site (hacked))
  4. Longest Palindrome (problem site)
  5. Repeating Substring (problem site)

Geometry

Advanced Techniques

  1. Meet in the Middle (problem site (hacked))
  2. Hamming Distance (problem site)
  3. Beautiful Subgrids (problem site)

Additional Problems

  1. Shortest Subsequence (problem site)
  2. Counting Bits (problem site)
  3. Swap Game (problem site)
  4. Prüfer Code (problem site)
  5. Acyclic Graph Edges (problem site)
  6. Advertisement (problem site)
  7. String Removals (problem site)
  8. Bit Inversions (problem site)
  9. Xor Pyramid (problem site)
  10. Writing Numbers (problem site)
  11. String Transform (problem site)
  12. Sorting Methods (problem site)
  13. Maximum Building I (problem site)
  14. Cyclic Array (problem site (hacked))
  15. Bit Problem (problem site)
  16. Grid Paths (problem site)
  17. Book Shop II (problem site)
  18. Network Breakdown (problem site)
  19. Visiting Cities (problem site)
  20. Number Grid (problem site)
  21. Stick Divisions (problem site)
  22. Permutations II (problem site)

Removed problems

  1. Longest Border (problem site (removed))