My solutions to over 350+ Competitive Programming (CP) Problems, drawn from:
- Hackerrank (my account; top 0.4%)
- Codechef (my account; 6*-Rating); and
- Advent of Code
For the uninitiated, CP Problems require you to write code to perform some computation on a range of test inputs and output the results. Submitting your Solution (constrained to a single source file) uploads it to the Online Judge, which automatically compiles it and feeds it the prepared test inputs. A Solution is given a perfect score only if each outputted result is correct, and (the tricky bit!) completes its processing within the allotted time (typically, 2 seconds per test input).
All but the most trivial Problems adhere to the following pattern: "there is an algorithm that solves the Problem that is simple but too slow, and to succeed you must create an algorithm that is (worst-case asymptotically) optimal." The difficulty of creating this algorithm ranges from "easy" to "very hard!" :)
All (non-Contest) Solutions in this repo received perfect scores. Most are reasonably well-written, with some having "Editorial"-style high level overviews (the asymptotically-optimal algorithms can be decidedly non-obvious). Many are ... not as high quality, though :)
Some were written during live contests, but the majority are Practice problems that can be done at your own pace.
This repo also contains some of my own problems, including ones that have been published (Chef and Gordon Ramsay 2 (née "Equilateral Treeangles"), Move the Coins 2! and Move the Coins - Creating Tests), and others that (sadly) ended up not being workable. Most also contain Testcase Generators (and shared helper utils), Problem Statements, Editorials, Python-based manim animations etc so you can see how much work goes into creating the things (2426 commits worth, apparently! ;))
The whole repo contains ~74k lines of C++ code (after stripping whitespace and comments), according to tokei.