This is an attempt to learn Python3 by completing challenges on HackerRank. The purpose here is to review coding challenges while learning a new languages. I am still new to the data structures in Python, so some of the solutions may be a little less than elegant:-) I hope to make a second pass to improve upon the code one I get more familure.
This Readme table of contents/progress is autogenerated. See util directory for the tools used to do so, and util/README.md for script execution order.
- Algorithms (11/442)
- Data Structures (0/121)
- Mathematics (0/283)
- Warmup (10/10)
- Implementation (1/66)
- Strings (0/48)
- Sorting (0/15)
- Search (0/26)
- Graph Theory (0/64)
- Greedy (0/24)
- Dynamic Programming (0/99)
- Constructive Algorithms (0/11)
- Bit Manipulation (0/27)
- Recursion (0/11)
- Game Theory (0/32)
- NP Complete (0/4)
- Debugging (0/5)
| # | Challenge | Solution |
|---|---|---|
| 1 | Solve Me First | Solution |
| 2 | Simple Array Sum | Solution |
| 3 | Compare the Triplets | Solution |
| 4 | A Very Big Sum | Solution |
| 5 | Diagonal Difference | Solution |
| 6 | Plus Minus | Solution |
| 7 | Staircase | Solution |
| 8 | Mini-Max Sum | Solution |
| 9 | Birthday Cake Candles | Solution |
| 10 | Time Conversion | Solution |
| # | Challenge | Solution |
|---|---|---|
| 1 | Big Sorting | No Attempt |
| 2 | Intro to Tutorial Challenges | No Attempt |
| 3 | Insertion Sort - Part 1 | No Attempt |
| 4 | Insertion Sort - Part 2 | No Attempt |
| 5 | Correctness and the Loop Invariant | No Attempt |
| 6 | Running Time of Algorithms | No Attempt |
| 7 | Quicksort 1 - Partition | No Attempt |
| 8 | Counting Sort 1 | No Attempt |
| 9 | Counting Sort 2 | No Attempt |
| 10 | The Full Counting Sort | No Attempt |
| 11 | Closest Numbers | No Attempt |
| 12 | Find the Median | No Attempt |
| 13 | Insertion Sort Advanced Analysis | No Attempt |
| 14 | Fraudulent Activity Notifications | No Attempt |
| 15 | Lily's Homework | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Hackerland Radio Transmitters | No Attempt |
| 2 | Gridland Metro | No Attempt |
| 3 | Ice Cream Parlor | No Attempt |
| 4 | KnightL on a Chessboard | No Attempt |
| 5 | Minimum Loss | No Attempt |
| 6 | Missing Numbers | No Attempt |
| 7 | Pairs | No Attempt |
| 8 | Sherlock and Array | No Attempt |
| 9 | Maximum Subarray Sum | No Attempt |
| 10 | Connected Cells in a Grid | No Attempt |
| 11 | Short Palindrome | No Attempt |
| 12 | Maximizing Mission Points | No Attempt |
| 13 | Count Luck | No Attempt |
| 14 | Cut the Tree | No Attempt |
| 15 | Making Candies | No Attempt |
| 16 | Gena Playing Hanoi | No Attempt |
| 17 | Beautiful Quadruples | No Attempt |
| 18 | Red Knight's Shortest Path | No Attempt |
| 19 | Bike Racers | No Attempt |
| 20 | Task Scheduling | No Attempt |
| 21 | Similar Pair | No Attempt |
| 22 | Absolute Element Sums | No Attempt |
| 23 | Almost Integer Rock Garden | No Attempt |
| 24 | Sorted Subsegments | No Attempt |
| 25 | Distant Pairs | No Attempt |
| 26 | King Richard's Knights | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Minimum Absolute Difference in an Array | No Attempt |
| 2 | Marc's Cakewalk | No Attempt |
| 3 | Grid Challenge | No Attempt |
| 4 | Luck Balance | No Attempt |
| 5 | Maximum Perimeter Triangle | No Attempt |
| 6 | Candies | No Attempt |
| 7 | Beautiful Pairs | No Attempt |
| 8 | Sherlock and The Beast | No Attempt |
| 9 | Priyanka and Toys | No Attempt |
| 10 | Largest Permutation | No Attempt |
| 11 | Mark and Toys | No Attempt |
| 12 | Greedy Florist | No Attempt |
| 13 | Max Min | No Attempt |
| 14 | Jim and the Orders | No Attempt |
| 15 | Permuting Two Arrays | No Attempt |
| 16 | Cutting Boards | No Attempt |
| 17 | Reverse Shuffle Merge | No Attempt |
| 18 | Goodland Electricity | No Attempt |
| 19 | Cloudy Day | No Attempt |
| 20 | Chief Hopper | No Attempt |
| 21 | Sherlock and MiniMax | No Attempt |
| 22 | Accessory Collection | No Attempt |
| 23 | Team Formation | No Attempt |
| 24 | Fighting Pits | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Lena Sort | No Attempt |
| 2 | Flipping the Matrix | No Attempt |
| 3 | Gaming Array | No Attempt |
| 4 | New Year Chaos | No Attempt |
| 5 | Bonetrousle | No Attempt |
| 6 | Yet Another KMP Problem | No Attempt |
| 7 | Beautiful 3 Set | No Attempt |
| 8 | Inverse RMQ | No Attempt |
| 9 | Two Subarrays | No Attempt |
| 10 | Lovely Triplets | No Attempt |
| 11 | Array Construction | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Lonely Integer | No Attempt |
| 2 | Maximizing XOR | No Attempt |
| 3 | Counter game | No Attempt |
| 4 | Xor-sequence | No Attempt |
| 5 | Sum vs XOR | No Attempt |
| 6 | The Great XOR | No Attempt |
| 7 | Flipping bits | No Attempt |
| 8 | Yet Another Minimax Problem | No Attempt |
| 9 | Sansa and XOR | No Attempt |
| 10 | AND Product | No Attempt |
| 11 | Winning Lottery Ticket | No Attempt |
| 12 | Xoring Ninja | No Attempt |
| 13 | Cipher | No Attempt |
| 14 | XOR Matrix | No Attempt |
| 15 | What's Next? | No Attempt |
| 16 | String Transmission | No Attempt |
| 17 | A or B | No Attempt |
| 18 | Manipulative Numbers | No Attempt |
| 19 | Stone Game | No Attempt |
| 20 | 2's complement | No Attempt |
| 21 | Changing Bits | No Attempt |
| 22 | XOR key | No Attempt |
| 23 | Maximizing the Function | No Attempt |
| 24 | XOR Subsequences | No Attempt |
| 25 | Iterate It | No Attempt |
| 26 | Hamming Distance | No Attempt |
| 27 | Mixing proteins | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | The Power Sum | No Attempt |
| 2 | Crossword Puzzle | No Attempt |
| 3 | Recursive Digit Sum | No Attempt |
| 4 | Simplified Chess Engine | No Attempt |
| 5 | Password Cracker | No Attempt |
| 6 | Arithmetic Expressions | No Attempt |
| 7 | Stone Division, Revisited | No Attempt |
| 8 | K Factorization | No Attempt |
| 9 | Bowling Pins | No Attempt |
| 10 | Simplified Chess Engine II | No Attempt |
| 11 | Repetitive K-Sums | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Game of Stones | No Attempt |
| 2 | Tower Breakers | No Attempt |
| 3 | A Chessboard Game | No Attempt |
| 4 | Introduction to Nim Game | No Attempt |
| 5 | Misère Nim | No Attempt |
| 6 | Nimble Game | No Attempt |
| 7 | Alice and Bob's Silly Game | No Attempt |
| 8 | Poker Nim | No Attempt |
| 9 | Tower Breakers, Revisited! | No Attempt |
| 10 | Tower Breakers, Again! | No Attempt |
| 11 | Zero-Move Nim | No Attempt |
| 12 | Chessboard Game, Again! | No Attempt |
| 13 | Digits Square Board | No Attempt |
| 14 | Fun Game | No Attempt |
| 15 | Stone Division | No Attempt |
| 16 | Chocolate in Box | No Attempt |
| 17 | Kitty and Katty | No Attempt |
| 18 | Powers Game | No Attempt |
| 19 | Deforestation | No Attempt |
| 20 | Bob and Ben | No Attempt |
| 21 | Tower Breakers - The Final Battle | No Attempt |
| 22 | Simple Game | No Attempt |
| 23 | Permutation game | No Attempt |
| 24 | Move the Coins | No Attempt |
| 25 | Play on benders | No Attempt |
| 26 | New Year Game | No Attempt |
| 27 | Stone Piles | No Attempt |
| 28 | Chocolate Game | No Attempt |
| 29 | The Prime Game | No Attempt |
| 30 | Vertical Rooks | No Attempt |
| 31 | A stones game | No Attempt |
| 32 | Tastes Like Winning | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Walking the Approximate Longest Path | No Attempt |
| 2 | Sam's Puzzle (Approximate) | No Attempt |
| 3 | Spies, Revised | No Attempt |
| 4 | TBS Problem | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Prime Dates | No Attempt |
| 2 | XOR Strings | No Attempt |
| 3 | Smart Number | No Attempt |
| 4 | Minimum Operations | No Attempt |
| 5 | Zig Zag Sequence | No Attempt |
- Arrays (0/6)
- Linked Lists (0/15)
- Trees (0/17)
- Balanced Trees (0/3)
- Stacks (0/9)
- Queues (0/5)
- Heap (0/4)
- Disjoint Set (0/4)
- Multiple Choice (0/3)
- Trie (0/2)
- Advanced (0/53)
| # | Challenge | Solution |
|---|---|---|
| 1 | Arrays - DS | No Attempt |
| 2 | 2D Array - DS | No Attempt |
| 3 | Dynamic Array | No Attempt |
| 4 | Left Rotation | No Attempt |
| 5 | Sparse Arrays | No Attempt |
| 6 | Array Manipulation | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Print the Elements of a Linked List | No Attempt |
| 2 | Insert a Node at the Tail of a Linked List | No Attempt |
| 3 | Insert a node at the head of a linked list | No Attempt |
| 4 | Insert a node at a specific position in a linked list | No Attempt |
| 5 | Delete a Node | No Attempt |
| 6 | Print in Reverse | No Attempt |
| 7 | Reverse a linked list | No Attempt |
| 8 | Compare two linked lists | No Attempt |
| 9 | Merge two sorted linked lists | No Attempt |
| 10 | Get Node Value | No Attempt |
| 11 | Delete duplicate-value nodes from a sorted linked list | No Attempt |
| 12 | Cycle Detection | No Attempt |
| 13 | Find Merge Point of Two Lists | No Attempt |
| 14 | Inserting a Node Into a Sorted Doubly Linked List | No Attempt |
| 15 | Reverse a doubly linked list | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Tree: Preorder Traversal | No Attempt |
| 2 | Tree: Postorder Traversal | No Attempt |
| 3 | Tree: Inorder Traversal | No Attempt |
| 4 | Tree: Height of a Binary Tree | No Attempt |
| 5 | Tree : Top View | No Attempt |
| 6 | Tree: Level Order Traversal | No Attempt |
| 7 | Binary Search Tree : Insertion | No Attempt |
| 8 | Tree: Huffman Decoding | No Attempt |
| 9 | Binary Search Tree : Lowest Common Ancestor | No Attempt |
| 10 | Swap Nodes [Algo] | No Attempt |
| 11 | Kitty's Calculations on a Tree | No Attempt |
| 12 | Is This a Binary Search Tree? | No Attempt |
| 13 | Square-Ten Tree | No Attempt |
| 14 | Balanced Forest | No Attempt |
| 15 | Jenny's Subtrees | No Attempt |
| 16 | Tree Coordinates | No Attempt |
| 17 | Array Pairs | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Self Balancing Tree | No Attempt |
| 2 | Array and simple queries | No Attempt |
| 3 | Median Updates | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Maximum Element | No Attempt |
| 2 | Balanced Brackets | No Attempt |
| 3 | Equal Stacks | No Attempt |
| 4 | Game of Two Stacks | No Attempt |
| 5 | Largest Rectangle | No Attempt |
| 6 | Simple Text Editor | No Attempt |
| 7 | Poisonous Plants | No Attempt |
| 8 | AND xor OR | No Attempt |
| 9 | Waiter | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Queue using Two Stacks | No Attempt |
| 2 | Castle on the Grid | No Attempt |
| 3 | Down to Zero II | No Attempt |
| 4 | Truck Tour | No Attempt |
| 5 | Queries with Fixed Length | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | QHEAP1 | No Attempt |
| 2 | Jesse and Cookies | No Attempt |
| 3 | Find the Running Median | No Attempt |
| 4 | Minimum Average Waiting Time | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Merging Communities | No Attempt |
| 2 | Components in a graph | No Attempt |
| 3 | Kundu and Tree | No Attempt |
| 4 | Super Maximum Cost Queries | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Data Structures MCQ 1 | No Attempt |
| 2 | Data Structures MCQ 2 | No Attempt |
| 3 | Data Structures MCQ 3 | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Contacts | No Attempt |
| 2 | No Prefix Set | No Attempt |
- Fundamentals (0/32)
- Number Theory (0/76)
- Combinatorics (0/57)
- Algebra (0/43)
- Geometry (0/30)
- Probability (0/28)
- Linear Algebra Foundations (0/17)
| # | Challenge | Solution |
|---|---|---|
| 1 | Points On a Line | No Attempt |
| 2 | Rectangular Game | No Attempt |
| 3 | Sherlock and Counting | No Attempt |
| 4 | Sherlock and Planes | No Attempt |
| 5 | Circle City | No Attempt |
| 6 | Xrange's Pancakes | No Attempt |
| 7 | Spheres | No Attempt |
| 8 | Baby Step, Giant Step | No Attempt |
| 9 | Points on a Rectangle | No Attempt |
| 10 | A Circle and a Square | No Attempt |
| 11 | Jim Beam | No Attempt |
| 12 | Hyperspace Travel | No Attempt |
| 13 | Solve Equations | No Attempt |
| 14 | Stars | No Attempt |
| 15 | Polar Angles | No Attempt |
| 16 | Sherlock and Geometry | No Attempt |
| 17 | Good Point | No Attempt |
| 18 | Hard Homework | No Attempt |
| 19 | Polygons | No Attempt |
| 20 | Polygon | No Attempt |
| 21 | Meeting Point | No Attempt |
| 22 | House Location | No Attempt |
| 23 | Jim and the Challenge | No Attempt |
| 24 | The Letter N | No Attempt |
| 25 | Best Sum | No Attempt |
| 26 | Geometry Queries | No Attempt |
| 27 | Count Triangles | No Attempt |
| 28 | Isosceles Triangles | No Attempt |
| 29 | Elastic rope | No Attempt |
| 30 | Painting Figures | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Random number generator | No Attempt |
| 2 | Sherlock and Probability | No Attempt |
| 3 | Day 4: Normal Distribution #1 | No Attempt |
| 4 | Day 4: Normal Distribution #2 | No Attempt |
| 5 | Vertical Sticks | No Attempt |
| 6 | Normal Distribution #3 | No Attempt |
| 7 | B'day Gift | No Attempt |
| 8 | Extremely Dangerous Virus | No Attempt |
| 9 | The Matchstick Experiment | No Attempt |
| 10 | Palindromes | No Attempt |
| 11 | Lazy Sorting | No Attempt |
| 12 | Binomial Distribution #1 | No Attempt |
| 13 | Binomial Distribution #2 | No Attempt |
| 14 | Binomial Distribution #3 | No Attempt |
| 15 | Kevin and Expected Value | No Attempt |
| 16 | The White Lotus and Caterpillar game | No Attempt |
| 17 | Assignment Problem | No Attempt |
| 18 | Connect the country | No Attempt |
| 19 | Random Integers Random Bits | No Attempt |
| 20 | Dice Stats | No Attempt |
| 21 | Magic Number Tree | No Attempt |
| 22 | Random Number Generator | No Attempt |
| 23 | Zombie March*** | No Attempt |
| 24 | Bear and Dancing | No Attempt |
| 25 | Randomness | No Attempt |
| 26 | Random | No Attempt |
| 27 | Mathematical Expectation | No Attempt |
| 28 | Colorful Polygon | No Attempt |
| # | Challenge | Solution |
|---|---|---|
| 1 | Linear Algebra Foundations #1 - Matrix Addition | No Attempt |
| 2 | Linear Algebra Foundations #2 - Matrix Subtraction | No Attempt |
| 3 | Linear Algebra Foundations #3- Matrix Multiplication | No Attempt |
| 4 | Linear Algebra Foundations #4- Matrix Multiplication | No Attempt |
| 5 | Linear Algebra Foundations #5 - The 100th Power of a Matrix | No Attempt |
| 6 | Linear Algebra Foundations #6 - An Equation involving Matrices | No Attempt |
| 7 | Linear Algebra Foundations #7 - The 1000th Power of a Matrix | No Attempt |
| 8 | Linear Algebra Foundations #8 - Systems of Equations | No Attempt |
| 9 | Linear Algebra Foundations #9 - Eigenvalues | No Attempt |
| 10 | Linear Algebra Foundations #10 - Eigenvectors | No Attempt |
| 11 | Determinant of the matrix #1 | No Attempt |
| 12 | Determinant of the matrix #2 | No Attempt |
| 13 | Determinant of the matrix #3 | No Attempt |
| 14 | Eigenvalue of a Matrix I | No Attempt |
| 15 | Eigenvalue of matrix #2 | No Attempt |
| 16 | Eigenvalue of matrix #3 | No Attempt |
| 17 | Eigenvalue of matrix #4 | No Attempt |