## Match a pattern and String without using regular expressions

Given a string, find out if string follows a given pattern or not without using any regular expressions. Examples: Input: string – GraphTreesGraph pattern -… Read More »

## Finding minimum vertex cover size of a graph using binary search

A vertex cover of an undirected graph is a subset of its vertices such that for every edge (u, v) of the graph, either ‘u’… Read More »

## Compute (a*b)%c such that (a%c) * (b%c) can be beyond range

Given three numbers a, b and c such that a, b and c can be at most 1016. The task is to compute (a*b)%c A… Read More »

## Implement a stack using single queue

We are given queue data structure, the task is to implement stack using only given queue data structure. We have discussed a solution that uses… Read More »

## Zoho Interview Experience | Set 12 (On-Campus)

Recently ZOHO visited our campus for recruitment and i would like to share my experience. Thanks to geeksforgeeks which contributed to most of my preparations..… Read More »

## Data Type Ranges and their macros in C++

Most of the times, in competitive programming, there is a need to assign the variable, the maximum or minimum value that data type can hold,… Read More »

## Print all subarrays with 0 sum

Given an array, print all subarrays in the array which has sum 0. Examples: Input: arr = [6, 3, -1, -3, 4, -2, 2, 4,… Read More »

## Transpose a matrix in Single line in Python

Transpose of a matrix is a task we all can perform very easily in python (Using a nested loop). But there are some interesting ways… Read More »

## Ways to copy a vector in C++

In case of arrays, there is no much choice to copy an array into other, other than iterative method i.e running a loop to copy… Read More »

## Puzzle 78 | The lost bus Number

Jay was an old friend of Rakesh and was coming to visit him from a small town. Jay came over late. When Rakesh asked… Read More »

## Heap’s Algorithm for generating permutations

Heap’s algorithm is used to generate all permutations of n objects. The idea is to generate each permutation from the previous permutation by choosing a… Read More »

## Print cousins of a given node in Binary Tree

Given a binary tree and a node, print all cousins of given node. Note that siblings should not be printed. Example: Input : root of… Read More »

## Return from void functions in C++

Void functions are “void” due to the fact that they are not supposed to return values. True, but not completely. We cannot return values but… Read More »

## Find cubic root of a number

Given a number n, find the cube root of n. Examples: Input: n = 3 Output: Cubic Root is 1.442250 Input: n = 8 Output:… Read More »

## Remove extra spaces from a string

Given a string containing many consecutive spaces, trim all spaces so that all words should contain only a single space between them. The conversion should… Read More »