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
map vs unordered_map in C++ Standard Template Library (STL) Internally, the elements in the unordered_map are not sorted in any particular order with respect to either their key or values (unlike map) C/C++, Hashmaps
nCr table | HackerRank Solution [Medium] Jim is doing his discrete maths homework which requires him to repeatedly calculate nCr(n choose r) for different values of n Dynamic Programming, Mathematics
Max Min | HackerRank Solution [Medium] Given a list of integers, arr, and a single integer k. Create an array of size k from elements of arr such that its unfairness is minimum Arrays
Common Child | Algorithms | HackerRank Solution [Medium] Given two strings p and q of equal length, what’s the longest string that can be constructed such that it is a child of both? Dynamic Programming
Generate Parentheses – LeetCode Solution [Medium] Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Competitive Programming
Sum of Left Leaves in Binary tree – LeetCode Solution [Easy] Given the root of a binary tree, return the sum of all left leaves. Number of nodes in the tree lie in the range – [1, 1000] Trees
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 <= i <= n), ans[i] is the number of 1's in the binary representation of i. 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