Skip to content

GabrielCFormiga/Competitive-Programming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

130 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Competitive Programming

This repository contains my solutions to competitive programming problems solved on various online judges.

The structure of the repository is simple: each folder is named according to the corresponding online judge, and the solution files are organized by the problem name, with links to the original sources.

Additionally, most problems are mapped by topic and can be easily accessed in the Problem Set.

I have categorized the problems as easy, medium, or hard based on my own perspective. While these classifications are subjective, they aim to reflect the effort and thought required to solve each problem. Sometimes, a problem that could be tagged as easy is actually medium or hard, as it involves recognizing properties that may not be immediately obvious.

Judges

This repository contains solutions from the following online judges:

Contests

Problem Set


Binary Search

Problem Category Difficulty
Binary Search Array Search 🟒 Easy
Closest to the left Array Search 🟒 Easy
Closest to the right Array Search 🟒 Easy
Fast Search Array Search πŸ”΅ Medium
Truck Driver Lower/Upper Bound πŸ”΅ Medium
Find First and Last Position of Element in Sorted Array Lower/Upper Bound 🟒 Easy
Search Insert Position Lower/Upper Bound 🟒 Easy
Find Right Interval Lower/Upper Bound πŸ”΅ Medium
Snuke Festival Lower/Upper Bound πŸ”΅ Medium
Interesting drink Search for Valid Answers 🟒 Easy
Packing Rectangles Search for Valid Answers 🟒 Easy
Very Easy Task Search for Valid Answers 🟒 Easy
Students Councils Search for Valid Answers πŸ”΅ Medium
Magic Powder - 1 Search for Valid Answers πŸ”΅ Medium
Children Holiday Search for Valid Answers πŸ”΄ Hard
String Game Search for Valid Answers πŸ”΄ Hard
Hamburguer Search for Valid Answers πŸ”΄ Hard
First Bad Version Search for Valid Answers 🟒 Easy
Valid Perfect Square Search for Valid Answers 🟒 Easy
Find Peak Element Search for Valid Answers πŸ”΅ Medium
Search in Rotated Sorted Array Search for Valid Answers πŸ”΅ Medium
Aggressive Cows Search for Valid Answers πŸ”΅ Medium
Guess a Number Search for Valid Answers 🟒 Easy
Magic Powder - 2 Search for Valid Answers πŸ”΅ Medium
Klee's SUPER DUPER LARGE Array Search for Valid Answers πŸ”΄ Hard
Ropes Search with Real Numbers 🟒 Easy
Equation Search with Real Numbers πŸ”΅ Medium
Solve it! Search with Real Numbers πŸ”΄ Hard
Get together Minmax 🟒 Easy
Splitting an Array Minmax 🟒 Easy
March Rain Minmax πŸ”΅ Medium
Cows in Stalls Minmax πŸ”΅ Medium
Minimum maximum on the Path Minmax πŸ”΄ Hard
Maximum Average Segment Maximum Average 🟒 Easy
Pair Selection Maximum Average 🟒 Easy
Minimum Average Path Minimum Average πŸ”΄ Hard
K-th Number in the Union of Segments Finding the K-th Element 🟒 Easy
Multiplication Table Finding the K-th Element πŸ”΅ Medium
K-th Sum Finding the K-th Element πŸ”΅ Medium

Bitmask

Problem Category Difficulty
Bit Operation I Bit Manipulation 🟒 Easy
Bit Operation II Bit Manipulation 🟒 Easy
Bit Flag Bit Manipulation 🟒 Easy
Bit Mask Bit Manipulation 🟒 Easy
XOR World Bit Manipulation 🟒 Easy
Serval and The Formula Bit Manipulation 🟒 Easy
Bits Bit Manipulation πŸ”΅ Medium
XOR Guessing Bit Manipulation πŸ”΅ Medium
Maximizing XOR Bit Manipulation 🟒 Easy
Flipping Bits Bit Manipulation 🟒 Easy
The Great XOR Bit Manipulation πŸ”΅ Medium
Sum vs XOR Bit Manipulation πŸ”΅ Medium
Cow Evolution Bit Manipulation πŸ”΄ Hard
Many Formulas Bit Manipulation 🟒 Easy
Red Scarf Bit Manipulation πŸ”΅ Medium
And Then There Were K Bit Manipulation 🟒 Easy
Fedor and New Game Bit Manipulation 🟒 Easy
Raising Bacteria Bit Manipulation 🟒 Easy
XORwice Bit Manipulation 🟒 Easy
Beautiful XOR Bit Manipulation πŸ”΅ Medium
Borya and Hanabi Bit Manipulation πŸ”΅ Medium
Points, Lines and Ready, Steady, Go! Bit Manipulation πŸ”΅ Medium
Enumeration of Subsets I Submask Enumeration 🟒 Easy
Enumeration of Subsets II Submask Enumeration 🟒 Easy
Enumeration of Subsets III Submask Enumeration 🟒 Easy
Enumeration of Combinations Submask Enumeration 🟒 Easy
Bars Submask Enumeration 🟒 Easy
Full House 3 Submask Enumeration 🟒 Easy
Preparing Olympiad Submask Enumeration 🟒 Easy
Little Girl and Maximum XOR Greedy πŸ”΅ Medium
And Or Greedy πŸ”΅ Medium
XOR Emergence Dynamic programming 🟒 Easy
Hackers' Crackdown Dynamic programming πŸ”΅ Medium
Prefix GCD Maximization Dynamic programming πŸ”΅ Medium
Compatibility Queries Dynamic programming πŸ”΄ Hard
Close Group Dynamic programming πŸ”΄ Hard

Brute Force

Problem Category Difficulty
Coprime Number Theory 🟒 Easy
250 Thousand Tons of TNT Number Theory 🟒 Easy
Perfect Number Greedy 🟒 Easy
Increasing Array Greedy 🟒 Easy
Bovine Genomics Implementation 🟒 Easy
Cow Gymnastics Implementation 🟒 Easy
Iroha's Obsession Implementation 🟒 Easy
Dreamoon and WiFi Implementation 🟒 Easy
Games Implementation 🟒 Easy
Lucky Numbers (Easy) Implementation 🟒 Easy
Satyam and Counting Implementation πŸ”΅ Medium

Data Structures

Problem Category Difficulty
Bad Sequence Greedy 🟒 Easy
Uniqueness Greedy 🟒 Easy
Two City Scheduling Greedy 🟒 Easy
I Am Very Busy Greedy 🟒 Easy
Movie Festival II Greedy πŸ”΅ Medium
Dragons Greedy 🟒 Easy
Sereja and Dima Greedy 🟒 Easy
Qualifying Contest Greedy 🟒 Easy
Cumulative Sum Query Prefix Sums/BIT/Segtree 🟒 Easy
Potentiometers BIT/Segtree 🟒 Easy
Inversion Count BIT/Segtree 🟒 Easy
Mega Inversions BIT/Segtree πŸ”΅ Medium
K-Query BIT/Segtree πŸ”΅ Medium
Salary Queries BIT/Segtree πŸ”΅ Medium
Curious Robin Hood BIT/Segtree 🟒 Easy
Points in Rectangle BIT2D/Segtree2D 🟒 Easy
Card Trick BIT + K-th πŸ”΅ Medium
Sliding Window Minimum Minimum Queue 🟒 Easy
Queries with Fixed Length Minimum Queue 🟒 Easy
Nearest Smaller Values Monotonic Stack 🟒 Easy
Advertisement Monotonic Stack πŸ”΅ Medium
Minimum Sum Monotonic Stack πŸ”΅ Medium
Sum of Subarray Minimums Monotonic Stack πŸ”΄ Hard
Imbalanced Array Monotonic Stack πŸ”΅ Medium
Nearest Taller Monotonic Stack 🟒 Easy
Bonfire Set Simulation πŸ”΅ Medium
Static Range Minimum Queries Sparse Table 🟒 Easy
Maximum modulo equality Sparse Table 🟒 Easy
Iva & Pav Sparse Table 🟒 Easy
Sereja and D Sparse Table πŸ”΅ Medium
Catapult that Ball Sparse Table πŸ”΅ Medium
Ant Colony Sparse Table πŸ”΅ Medium

Disjoint Sets Union

Problem Category Difficulty
Disjoint Sets Union Disjoint Sets Union 🟒 Easy
Disjoint Sets Union 2 Disjoint Sets Union 🟒 Easy
Experience Disjoint Sets Union πŸ”΅ Medium
War Disjoint Sets Union πŸ”΄ Hard
Cutting a graph Offline Deletion πŸ”΅ Medium
Anansi's Cobweb Offline Deletion πŸ”΅ Medium
People are leaving Merge Segments 🟒 Easy
Parking Merge Segments 🟒 Easy
Restructuring Company Merge Segments πŸ”΅ Medium

Dynamic Programming

Problem Category Difficulty
Robot Customize Knapsack Variation 🟒 Easy
Book Shop Knapsack 🟒 Easy
Knapsack 1 Knapsack 🟒 Easy
The Values You Can Make Knapsack πŸ”΅ Medium
Minimizing Coins Min DP 🟒 Easy
Removing Digits Min DP 🟒 Easy
Frog 1 Min DP 🟒 Easy
Frog 2 Min DP 🟒 Easy
Vacation Min DP 🟒 Easy
Dice Combinations Arrangement Count 🟒 Easy
Coin Combinations I Arrangement Count 🟒 Easy
Coin Combinations II Combination Count 🟒 Easy
Grid Paths I Upper/Left DP on Grid 🟒 Easy
Iroha and a Grid Upper/Left DP on Grid πŸ”΄ Hard
Array Description Propagation DP 🟒 Easy
Counting Towers Propagation DP 🟒 Easy
Edit Distance Top Down DP 🟒 Easy
Longest Common Subsequence Top Down DP 🟒 Easy
Projects Top Down DP πŸ”΅ Medium
Mahmoud and a Message Top Down DP πŸ”΅ Medium
Maximum Subarray Sum Kadane 🟒 Easy
Easy Longest Increasing Subsequence LIS 🟒 Easy
Money Sums Knapsack πŸ”΅ Medium
Two Sets II Knapsack πŸ”΅ Medium
Removal Game Interval DP πŸ”΅ Medium

Graphs

Problem Category Difficulty
Coronavirus Spread BFS 🟒 Easy
Grass Planting Trees 🟒 Easy
Milk Factory Trees πŸ”΅ Medium
Livestock Lineup DFS πŸ”΅ Medium
The Great Revegetation Coloring πŸ”΅ Medium

Math

Problem Category Difficulty
Buy a Shovel Implementation 🟒 Easy
Is your horseshoe on the other hoof? Implementation 🟒 Easy
Young Physicist Implementation 🟒 Easy
Shell Game Implementation 🟒 Easy
Blocked Billboard Implementation 🟒 Easy
Square Pasture Implementation 🟒 Easy
Fence Painting Implementation 🟒 Easy
Swapity Swap Implementation 🟒 Easy
Blocked Billboard II Implementation πŸ”΅ Medium
Around Square Implementation 🟒 Easy
Buy a Pen Implementation 🟒 Easy
Candy Button Implementation 🟒 Easy
Children and Candies (ABC Edit) Implementation 🟒 Easy
Doors in the Center Implementation 🟒 Easy
Happy Birthday! 4 Implementation 🟒 Easy
Be Together Implementation πŸ”΅ Medium
Bear and Big Brother Implementation 🟒 Easy
Beautiful Average Implementation 🟒 Easy
Beautiful Matrix Implementation 🟒 Easy
Black Square Implementation 🟒 Easy
Chloe and the Sequence Implementation 🟒 Easy
Domino Piling Implementation 🟒 Easy
Gravity Flip Implementation 🟒 Easy
Madoka and Math Dad Implementation 🟒 Easy
Madoka and the Elegant Gift Implementation 🟒 Easy
Minimize Implementation 🟒 Easy
Police Recruits Implementation 🟒 Easy
Team Implementation 🟒 Easy
The Legend of Freya the Frog Implementation 🟒 Easy
Vanya and Fences Implementation 🟒 Easy
Xenia and Ringroad Implementation 🟒 Easy
Madoka and Childish Pranks Implementation πŸ”΅ Medium
Line Implementation πŸ”΅ Medium
Serval and Final MEX Implementation πŸ”΅ Medium
Expression Brute Force 🟒 Easy
Removal of a Sequence (Easy Version) Implementation + Number Theory πŸ”΅ Medium
Removal of a Sequence (Hard Version) Implementation + Number Theory πŸ”΄ Hard

Number Theory

Problem Category Difficulty
Lucky Division Brute Force 🟒 Easy
Primal Fear Brute Force 🟒 Easy
Almost Prime Brute Force 🟒 Easy
Count Primes Sieve 🟒 Easy
Printing Some Primes Sieve 🟒 Easy
T-primes Sieve 🟒 Easy
Prime Multiples Inclusion-Exclusion πŸ”΅ Medium
2^a b^2 Implementation 🟒 Easy
Arpa's Obvious Problem and Mehrdad's Terrible Solution Implementation 🟒 Easy
Greatest Common Divisor GCD 🟒 Easy
Modular GCD GCD πŸ”΄ Hard
Orac and LCM GCD πŸ”΅ Medium
Medium Factorization Prime Factorization 🟒 Easy
Divisor Summation Prime Factorization 🟒 Easy
Integer Factorization (15 Digits) Prime Factorization πŸ”΄ Hard
Simple Repetition Prime Factorization 🟒 Easy
Ringo's Favorite Numbers 3 Prime Factorization 🟒 Easy
Soldier and Number Game Prime Factorization πŸ”΅ Medium
Div Game Prime Factorization πŸ”΅ Medium
Printing Divisors Prime Factorization πŸ”΅ Medium
Simple Sum Prime Factorization πŸ”΄ Hard

Prefix Sums

Problem Category Difficulty
Find Pivot Index Target Sum 🟒 Easy
Subarray Sums II Target Sum 🟒 Easy
Subarray Sum Equals K Target Sum 🟒 Easy
Subarray Divisibility Target Divisibility 🟒 Easy
Subarray Sums Divisible by K Target Divisibility 🟒 Easy
Forest Queries 2D Prefix Sums 🟒 Easy

Two Pointers Method

Problem Category Difficulty
Merging Arrays Two Pointers Method 🟒 Easy
Number of Smaller Two Pointers Method 🟒 Easy
Number of Equal Two Pointers Method 🟒 Easy
Counting Kangaroos is Fun Two Pointers Method 🟒 Easy
Subarray Sums I Segment with good sum 🟒 Easy
Books Segment with good sum 🟒 Easy
Segment with Big Sum Segment with good sum 🟒 Easy
Number of Segments with Small Sum Segment with good sum 🟒 Easy
Number of Segments with Big Sum Segment with good sum 🟒 Easy
Restaurant Customers Sweep Line 🟒 Easy
Segment with Small Sum Segment with good sum 🟒 Easy

Strings

Problem Category Difficulty
String Task Implementation 🟒 Easy
ABCBA Implementation 🟒 Easy
Big Sorting Implementation 🟒 Easy
Iroha and Haiku (ABC Edition) Implementation 🟒 Easy
Iroha Loves Strings (ABC Edition) Implementation 🟒 Easy
Unhappy Hacking (ABC Edit) Implementation 🟒 Easy
1122 Substring 2 Implementation πŸ”΅ Medium
Anton and Danik Implementation 🟒 Easy
Beautiful String Implementation 🟒 Easy
Boy or Girl Implementation 🟒 Easy
cAPS lOCK Implementation 🟒 Easy
Colorful Stones (Simplified Edition) Implementation 🟒 Easy
Magnets Implementation 🟒 Easy
Night at the Museum Implementation 🟒 Easy
osu!mania Implementation 🟒 Easy
Petya and Strings Implementation 🟒 Easy
Serval and String Theory Implementation 🟒 Easy
Stones on the Table Implementation 🟒 Easy
Word Implementation 🟒 Easy
Chat room Greedy 🟒 Easy
Lucky Substring Brute Force 🟒 Easy

About

Competitive Programming - Problem solutions from online judges mapped by topics.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages