algorithms
algorithms copied to clipboard
HackerRank, Codeforces, Geeks for Geeks, and LeetCode problem solutions
README
This is a collection of my HackerRank, Codeforces, Geeks for Geeks, and LeetCode problem solutions in C++, Java, and Python 3. These are not meant to be competition style implementations but clean and easily understandable algorithms for learning purposes.
HackerRank
-
Algorithms
-
Bit Manipulation
- AND Product
- Cipher
- Flipping Bits
-
Dynamic Programming
- Candies
- The Coin Change Problem
- Fibonacci Modified
- Grid Walking
- Longest Common Subsequence
- Longest Increasing Subsequence
- Maximum Subarray
- Square Subsequences
- Stock Maximize
- Summing Pieces
-
Graph Theory
- BFS: Shortest Reach
- Crab Graphs
- Dijkstra: Shortest Reach 2
- Floyd: City of Blinding Lights
- Jack goes to Rapture
- Journey to the Moon
- Kruskal (MST): Really Special Subtree
- Prim's (MST): Special Subtree
- SCC
-
Implementation
- Matrix Rotation
-
Search
- Connected Cell in a Grid
- Cut the Tree
- Max Sum K Non-Adjacent
- Maximise Sum
- Missing Numbers
- Pairs
- Playing With Numbers
- Sherlock and Array
- Short Palindrome
-
Sorting
- Quicksort In-Place
-
Strings
- Bigger is Greater
- Common Child
- Pangrams
- Sherlock and Anagrams
- Two Strings
-
Bit Manipulation
-
Artificial Intelligence
- Tic Tac Toe
-
Data Structures
-
Disjoint Set
- Merging Communities
-
Heap
- Find Median
-
Tree
- BST: Lowest Common Ancestor
- Median Updates
- Self Balancing Tree
-
Trie
- No Prefix Set
-
Disjoint Set
-
Mathematics
-
Combinatorics
- Choose and Calculate
- Journey to Mars
- nCr Table
- Rank of a Word
-
Combinatorics
CodeForces
- 229D Towers
- 276C Little Girl and Maximum Sum
- 342E Xenia and Tree
- 547B Mike and Feet
- 637D Running with Obstacles
- 749D Leaving Auction
- 750D New Year and Fireworks
- 753B Interactive Bulls and Cows (Easy)
- 753C Interactive Bulls and Cows (Hard)
- 754D Fedor and Coupons
- 758D Ability To Convert
- 758E Broken Tree
- 758F Geometric Progression
- 780D Innokenty and a Football League
- 780E Underground Lab
- 792D Paths in a Complete Binary Tree
- 796D Police Stations
- 796E Exam Cheating
- 815C Karen and Supermarket
- 818D Multicolored Cars
- 819B Mister B and PR Shifts
- 819E Mister B and Flight to the Moon
- 827C DNA Evolution
- 830B Cards Sorting
- 833B The Bakery
- 835E The Penguin's Game
Geeks for Geeks
-
Dynamic Programming
- Set 18 - Partition Problem
-
Mathematics
- Weighted Random Generator
-
Linked List
- Flatten Multi Level Linked List
LeetCode
-
Algorithms
- 4Sum
- Basic Calculator
- Preorder and Inorder Traversal
- Postorder and Inorder Traversal
- Binary Tree Maximum Path Sum
- Binary Tree Zigzag Level Order Traversal
- Burst Balloons
- Closest Palindrome
- Container With Most Water
- Contains Duplicate III
- Data Stream as Disjoint Intervals
- Difference Ways to Add Parenthesis
- Distinct Subsequences
- Dungeon Game
- Edit Distance
- Encode String with Shortest Length
- Flatten Binary Tree to Linked List
- Game of Life
- Gas Station
- Interleaving String
- Is Balanced
- K Pairs with Smallest Sums
- Kth Largest Element
- Kth Smallest Element in Sorted Matrix
- Largest Rectangle in Histogram
- LCA of a Binary Tree
- Lexicographical Numbers
- LFU Cache
- Linked List Cycle II
- Longest Valid Parenthesis
- Majority Element II
- Max Points on a Line
- Maximum Gap
- Median of Two Sorted Arrays
- Mini Parser
- Minimum Height Tree
- Minimum Window Substring
- N-Queens II
- Non Overlapping Intervals
- Palindrome Linked List
- Palindrome Pairs
- Permutation Sequence
- Permutations II
- Range Sum Query - Mutable
- Recover Binary Tree
- Rectangle Area
- Regular Expression Matching
- Remove Duplicates from Sorted Array II
- Remove K Digits
- Reverse Nodes in k-Group
- Reverse Words in a String
- Rotate Image
- Set Matrix Zeroes
- Skyline
- Sliding Window Maximum
- Shortest Palindrome
- Sorted Array to BST
- Spiral Matrix
- Sqrt(x)
- Stock Profit III
- Stock Profit IV
- Subsets II
- Substring with Concatenation of All Words
- Sudoku Solver
- Unique Substrings in Wraparound String
- Validate BST
- Wiggle Subsequence
- Wildcard Matching
- Word Break