All Medium Articles
The Longest Increasing Subsequence (LIS) problem is to find the length of the longest subsequence of a given sequence such that all elements of the… Read More
The Longest Increasing Subsequence (LIS) problem is to find the length of the longest subsequence of a given sequence such that all elements of the… Read More
Given an array and an integer K, find the maximum for each and every contiguous subarray of size k. Examples :  Input: arr[] = {1,… Read More
Given an array arr[], find the maximum j – i such that arr[j] > arr[i]. Examples :  Input: {34, 8, 10, 3, 2, 80, 30,… Read More
Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] in txt[]. You… Read More
Write a function detectAndRemoveLoop() that checks whether a given Linked List contains loop and if loop is present then removes the loop and returns true.… Read More
Write a function that returns true if the given Binary Tree is SumTree else false. A SumTree is a Binary Tree where the value of… Read More
What is the difference between a mutex and a semaphore? When should you use a mutex and when should you use a semaphore?  A concrete… Read More
Following two algorithms are generally taught for Minimum Spanning Tree (MST) problem. Prim’s algorithm Kruskal’s algorithm There is a third algorithm called Boruvka’s algorithm for… Read More
Given a linked list, write a function to reverse every alternate k nodes (where k is an input to the function) in an efficient way.… Read More
The Fibonacci numbers are the numbers in the following integer sequence.0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, …….. In… Read More
In C++, the programmer abstracts real world objects using classes as concrete types. Sometimes it is required to convert one concrete type to another concrete… Read More
Given the root of a binary search tree and K as input, find Kth smallest element in BST. For example, in the following BST, if k… Read More
Given a program on fork() system call. #include <stdio.h> #include <unistd.h> int main() {    fork();    fork() && fork() || fork();    fork();       printf("forked\n");    return 0;… Read More
Predict the output of below C++ programs. Question 1 #include<iostream>    using namespace std; class P { public:    void print()    { cout <<" Inside P::";… Read More
At compile time, the compiler exports each global symbol to the assembler as either strong or weak, and the assembler encodes this information implicitly in… Read More