Various algorithmic challenges solutions (rather unstructured).
The file name relevant to the challenge is usually an abbreviation from the challenge title. Some include built-in pytest cases, other require to be run with a test input file (name convention includes the *.py
file name with _test_*.txt
ending ).
All below has been done ad-hoc during few months period of time for self-entertaining purpose, so each file is a self-contained mini-program. They are mostly Python3.7, but there might be few old crafted with Python2.7 manner. It could be that some include some notes, "alternative" versions of the code, commented blocks or other random bits. I treat this as a personal archive - not a thing to show off.
General challenges:
- Dijakstra's
HackerRank challenges:
-
Mark and Toys https://www.hackerrank.com/challenges/mark-and-toys
-
Fraudulent Activity Notifications https://www.hackerrank.com/challenges/fraudulent-activity-notifications
-
Making Candies * https://www.hackerrank.com/challenges/making-candies
-
Merge Sort: Counting Inversions * https://www.hackerrank.com/challenges/ctci-merge-sort
-
Friend Circle Queries https://www.hackerrank.com/challenges/friend-circle-queries
-
Frequency Queries https://www.hackerrank.com/challenges/frequency-queries
-
New Year Chaos https://www.hackerrank.com/challenges/new-year-chaos
-
Trees: Is This a Binary Search Tree? https://www.hackerrank.com/challenges/ctci-is-binary-search-tree
-
Tree: Height of a Binary Tree https://www.hackerrank.com/challenges/tree-height-of-a-binary-tree
-
Count Triplets https://www.hackerrank.com/challenges/count-triplets-1
-
Two Strings https://www.hackerrank.com/challenges/two-strings
-
Hash Tables: Ransom Note https://www.hackerrank.com/challenges/ctci-ransom-note
-
2D Array - DS https://www.hackerrank.com/challenges/2d-array
-
BFS: Shortest Reach in a Graph https://www.hackerrank.com/challenges/ctci-bfs-shortest-reach
-
DFS: Connected Cell in a Grid https://www.hackerrank.com/challenges/ctci-connected-cell-in-a-grid
-
Roads and Libraries https://www.hackerrank.com/challenges/torque-and-development
-
Maximum Xor https://www.hackerrank.com/challenges/maximum-xor
-
Flipping bits https://www.hackerrank.com/challenges/flipping-bits
-
Time Complexity: Primality https://www.hackerrank.com/challenges/ctci-big-o
-
[time-out] Time Complexity: Primality https://www.hackerrank.com/challenges/ctci-big-o
-
Linked Lists: Detect a Cycle https://www.hackerrank.com/challenges/ctci-linked-list-cycle
-
Recursion: Davis' Staircase https://www.hackerrank.com/challenges/ctci-recursive-staircase
-
Recursion: Fibonacci Numbers https://www.hackerrank.com/challenges/ctci-fibonacci-numbers
-
Minimum Swaps 2 https://www.hackerrank.com/challenges/minimum-swaps-2
-
Array Manipulation https://www.hackerrank.com/challenges/crush
-
Swap Nodes https://www.hackerrank.com/challenges/swap-nodes-algo
-
Queues: A Tale of Two Stacks https://www.hackerrank.com/challenges/ctci-queue-using-two-stacks
-
Balanced Brackets https://www.hackerrank.com/challenges/balanced-brackets
-
Luck Balance https://www.hackerrank.com/challenges/luck-balance
-
Abbreviation https://www.hackerrank.com/challenges/abbr
-
Common Child https://www.hackerrank.com/challenges/common-child
-
Sherlock and the Valid String https://www.hackerrank.com/challenges/sherlock-and-valid-string
-
Game of Thrones - I https://www.hackerrank.com/challenges/game-of-thrones
-
The Love-Letter Mystery https://www.hackerrank.com/challenges/the-love-letter-mystery
-
Merge Sort: Counting Inversions * https://www.hackerrank.com/challenges/ctci-merge-sort
-
Sorting: Comparator https://www.hackerrank.com/challenges/ctci-comparator-sorting
-
Alternating Characters https://www.hackerrank.com/challenges/alternating-characters
-
Arrays: Left Rotation https://www.hackerrank.com/challenges/ctci-array-left-rotation
-
Sherlock and Anagrams https://www.hackerrank.com/challenges/sherlock-and-anagrams
-
New Year Chaos https://www.hackerrank.com/challenges/new-year-chaos
-
Repeated String https://www.hackerrank.com/challenges/repeated-string
-
Jumping on the Clouds https://www.hackerrank.com/challenges/jumping-on-the-clouds
-
Counting Valleys https://www.hackerrank.com/challenges/counting-valleys
-
Sock Merchant https://www.hackerrank.com/challenges/sock-merchant
(*) marked solutions time-out with Python3 at HackerRank, but some of them pass with CPython selected or Pypy. It's a "popular problem" with HackerRank submissions for Python3.