How to calculate Binomial Coefficient (nCr) in O(r) time complexity The recomputations in calculating binomial coefficient (nCr) can be avoided by exploiting optimal substructure and overlapping subproblems Competitive Programming, Dynamic Programming, Mathematics
Array Manipulation | HackerRank Solution [Hard] Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each the array element between two given indices, inclusive. Once all operations have been performed, return the maximum value in the array. Arrays, Competitive Programming, Sorting
Palindrome Index | HackerRank Solution [Easy] Given a string of lowercase letters in the range ascii[a-z], determine the index of a character that can be removed to make the string a palindrome Competitive Programming, Greedy approach
Sherlock and MiniMax | HackerRank Solution [Hard] Given an integer range, for all M in that inclusive range, determine the minimum – abs(arr[i]-M) for all i Arrays, Competitive Programming, Mathematics
PacMan – DFS | HackerRank Solution [Easy] Print all the nodes that you encounter while printing DFS tree. Then, print the distance ‘D’ between the source ‘P’ and the destination ‘.’ Competitive Programming, Depth First Search (DFS)
Reverse Shuffle Merge | HackerRank Solution [Advanced] Given a string s such that, s ∈ merge(reverse(A), shuffle(A)) for some string A, find the lexicographically smallest A Competitive Programming
Generate Parentheses – LeetCode Solution [Medium] Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Competitive Programming
Counting Bits O(n) Solution – LeetCode [Easy] | Brian Kernighan’s Algorithm Given an integer n, return an array ans of length n + 1 such that for each i (0 Algorithms, Competitive Programming, Mathematics
Longest Substring Without Repeating Characters – LeetCode Solution [Medium] Given a string s, consisting of English letters, symbols and spaces, find the length of the longest substring without repeating characters. Competitive Programming, Hashmaps
Substring Diff | HackerRank (Algorithms) | Longest Common Substring Given two strings and an integer, determine the length of the longest common substrings of the two strings that differ in no more than k positions. Competitive Programming, Dynamic Programming