Category Archives: Algorithms

Given an array arr[] where each element represents the max number of steps that can be made forward from that index. The task is to… Read More
Difficulty Level: Rookie Given a stream of numbers, print the average (or mean) of the stream at every point. For example, let us consider the… Read More
Given an array of integers which is initially increasing and then decreasing, find the maximum value in the array. Examples :  Input: arr[] = {8, 10,… Read More
Given two integers k and n, write a function that prints all the sequences of length k composed of numbers 1,2..n. You need to print… Read More
Asymptotic Analysis is defined as the big idea that handles the above issues in analyzing algorithms. In Asymptotic Analysis, we evaluate the performance of an… Read More
Given an array of n distinct integers sorted in ascending order, write a function that returns a Fixed Point in the array, if there is… Read More
Question 1 Predict the output of the following program. What does the following fun() do in general?  C++ #include <iostream> using namespace std;    int… Read More
Write a program to find the smallest of three integers, without using any of the comparison operators. Let 3 input numbers be x, y and z.Method… Read More
Given a cost matrix cost[][] and a position (m, n) in cost[][], write a function that returns cost of minimum cost path to reach (m,… Read More
Given a cost matrix cost[][] and a position (m, n) in cost[][], write a function that returns cost of minimum cost path to reach (m,… Read More
Given a cost matrix cost[][] and a position (m, n) in cost[][], write a function that returns cost of minimum cost path to reach (m,… Read More
Given a cost matrix cost[][] and a position (M, N) in cost[][], write a function that returns cost of minimum cost path to reach (M,… Read More
Given that integers are read from a data stream. Find the median of elements read so for in an efficient way. For simplicity assume, there… Read More
Question 1 Consider the following recursive C function. Let len be the length of the string s and num be the number of characters printed on… Read More
Subset sum problem is to find subset of elements that are selected from a given set whose sum adds up to a given number K. We… Read More