Skip to content

Toughest competitive programming challenges, "un-toughed." A collection of rare, step-by-step code elucidations.

Notifications You must be signed in to change notification settings

RafaelMolyna/Toughest-Codes-Archive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

Toughest Codes Archive

Competitive Programming Solutions, Un-toughed

A collection of rare, step-by-step code elucidations.

Status Contributions-welcome Languages License: MIT Visitors

👋 Welcome

Hello! Ever searched for a solution to a 1% acceptance rate problem, only to find... nothing? Even when you do find one, a 50-line C++ file with zero comments isn't always helpful.

This repository is my contribution to filling that void!

When I started programming, I jumped into Competitive Programming to fill the gaps in my knowledge of Computer Science algorithms and data structures. I practiced extensively on Beecrowd (formerly URI Online Judge), enjoying its friendly interface and categorized difficulty levels.

I'm providing here some revised solutions I created at that time, solving some of the most intricated and challenging competitive programming problems in the platform, sidealong with their step-by-step logic breakdown and commented code, in order to help other students.

Some of these solutions cost me a bunch of time and deep reflection to build, ending up being really creative and smart, but achieving the first positions in the ranks! Enjoy them! 🎉

💭 The Philosophy

My strategy to master a new subject has always been to tackle the hardest problems first. In my experience—from college entrance exams in Brazil to engineering coursework—this yields the best results in the shortest time.

However, finding a good solution for a hard problem is difficult. It can take weeks to solve a single puzzle. When you hit that wall, the standard process is to look for guidance: scan a solution, break it down, understand the logic, and then implement it yourself.

The Problem: I frequently faced amazing, challenging problems but couldn't find one single suggestion. No tips, no comments, just void.

I lamented this "hiding" culture. While ranks matter to some, I believe the real gold lies in understanding how to unpuzzle these intricate challenges.

This repository is my contribution to filling that void.

🎯 Why This Matters

This isn't just a code dump. It is an educational archive.

  1. Documentation: I focus on problems with a difficulty level of 7 or above (scale 1-10).
  2. Evolution: You will see my code evolve. I include my original solutions (from when I was learning, sometimes messy) alongside AI-revised and optimized versions.
  3. Polyglot: While I started with JavaScript, I provide C++ and Python comparisons to match the "top league" performance standards.

⚡ Why JavaScript?

You might ask: "Why solve competitive programming problems in JS?"

I know it isn’t the traditional competitive-programming weapon — C++ owns that territory.
But I was building my career in the JS ecosystem, and choosing JS for algorithmic challenges helped me sharpen:

  • efficient JS data structures
  • memory patterns
  • dynamic optimization
  • bitwise manipulation
  • low-level tuning inside a high-level language

Eventually, I also implemented C++ and Python versions whenever JS hit its limits or when comparison was useful.

Finding performant public solutions for JS was incredibly rare. I struggled with that, so now I am fixing it for the next person.

📂 Repository Structure

To keep things organized and scalable for future platforms, the archive is structured as follows:

/
├── BeeCrowd/                  # Solutions for Beecrowd (URI)
│   ├── 1023-Drought/          # Problem ID and Name
│   │   ├── README.md          # Step-by-step logic explanation
│   │   ├── solution.js        # Clean, commented, revised code
│   │   ├── solution.cpp       # C++ version for performance comp
│   │   ├── solution_original.js # My raw, original submission
│   │   └── input_samples.txt
│   └── ...
├── CodeForces/                # (Future placeholder)
└── README.md

🔍 What is Inside a Solution?

Every solution folder in this archive contains:

  1. Step-by-Step Explanation: A detailed Markdown file breaking down the logic, the algorithm used, and the history of the attempt.
  2. Fully Commented Code: Optimized solutions in JS, C++, and Python (where possible), including headers with rank and runtime.
  3. Original Solution: The accepted code I wrote years ago, untouched by AI. This serves as a baseline to show logic improvements and refactoring.

🤝 How to Contribute

I am building this in the open, but I can't find every bug or optimization alone.

HAVE THE COURAGE TO SHARE.

If you have a better approach—a faster algorithm, a bug fix, or a cleaner syntax—don't hoard it.

  1. Fork this repository.
  2. Create a folder for a new hard problem (following the structure above) OR improve an existing one.
  3. Submit a Pull Request.

Let's make this the best-explained archive of hard problems on the internet, together.

🗂️ Navigation / Index

All solutions are organized by their problem ID.


Created with ❤️ by Rafael Molina Ogallas. Happy Coding!

About

Toughest competitive programming challenges, "un-toughed." A collection of rare, step-by-step code elucidations.

Resources

Stars

Watchers

Forks