Fundamental building blocks for organizing and storing data efficiently.
Problem Statement: Given an array representing a queue of customers and the value of bills they hold, determine if it is possible to provide correct change to each customer. Customers can only pay...
Problem Statement: Given an array of k linked-lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list Examples Examples 1: Input Format: Lists:...
Problem Statement: You are given a 0-indexed 2-D grid g of size N*M, where each cell contains a positive integer, and adjacent cells are distinct. You need to find the location of a peak element in...
Problem Statement: Given a decimal number N, remove the rightmost set bit ie. the rightmost 1 in the binary representation and return the updated number. Examples Input: N = 12 Output: 8 Explanatio...
Problem Statement: Given a decimal number N and an index i, toggle the ith position of the number, i.e., if the bit at position i is 0, then change it to 1, and if it is 1, then change it to 0. Exa...
Problem Statement: Design and maintain a data structure that supports the following functions of a web browser: Browser (Homepage): Set homepage of the browser. Visit (Url): Visit the url from the...
Problem Statement: Given a linked list, sort its nodes based on the data value in them. Return the head of the sorted linked list. Examples Input: 3->4->2->1->5 Output: 1->2->3->4->5 Explanation: T...
Up until now we have looked at Trie and the various functions that can be performed on it like searching, insertion and fniding prefix. An important application of bitwise operations in tries is XO...
Problem Statement: Given a string array nums of length n. A string is called a complete string if every prefix of this string is also present in the array nums. Find the longest complete string in...
Problem Statement: Given a root of Binary Tree, where the nodes have integer values. Return the size of the largest subtree of the binary tree which is also a BST. A binary search tree (BST) is a b...