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 »
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 »
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 »
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 »
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 »
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 »
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 »
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 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 »
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 »
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 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 »
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 »
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 »
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 »
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 »