Skip to content
All Medium Articles
An undirected graph is called Biconnected if there are two vertex-disjoint paths between any two vertices. In a Biconnected Graph, there is a simple cycle… Read More
Given a string, eliminate all “b” and “ac” in the string, you have to replace them in-place, and you are only allowed to iterate over… Read More
My Google Interview Experience, [Hope this is helpful] I am AnandhaKumar .P – 2012 IT pass out from College Of Engineering Guindy, Anna University. As… Read More
A directed graph is strongly connected if there is a path between all pairs of vertices. A strongly connected component (SCC) of a directed graph… Read More
Given a Weighted Directed Acyclic Graph and a source vertex in the graph, find the shortest paths from given source to all other vertices. Recommended:… Read More
Topological sorting for Directed Acyclic Graph (DAG) is a linear ordering of vertices such that for every directed edge u v, vertex u comes before… Read More
Topological sorting for Directed Acyclic Graph (DAG) is a linear ordering of vertices such that for every directed edge uv, vertex u comes before v… Read More
Given a singly linked list, swap kth node from beginning with kth node from end. Swapping of data is not allowed, only pointers should be… Read More
Consider the problem of searching an element x in an array ‘arr[]’ of size n. The problem can be solved in O(Logn) time if. 1)… Read More
Given an array of integers, sort the array according to frequency of elements. For example, if the input array is {2, 3, 2, 4, 5,… Read More
Given a string str, the task is to find the minimum number of characters to be inserted to convert it to palindrome.Before we go further,… Read More
Given a dictionary of words and an input string, find the longest prefix of the string which is also a word in dictionary. Examples: Let… Read More
Following is a typical recursive implementation of QuickSort for arrays. The implementation uses last element as pivot.  C++ /* A typical recursive implementation of Quicksort… Read More
  Introduction: B-Tree is a self-balancing search tree. In most of the other self-balancing search trees (like AVL and Red-Black Trees), it is assumed that everything… Read More
An array contains both positive and negative numbers in random order. Rearrange the array elements so that positive and negative numbers are placed alternatively. Number… Read More
Hello Guys, I had 6 rounds(written + telephonic+ 4f2f interviews) in hyderabad centre of Amazon. I was 90% sure that I would clear the interview… Read More
Given two strings where first string may contain wild card characters and second string is a normal string. Write a function that returns true if… Read More
Given a Binary Tree (Bt), convert it to a Doubly Linked List(DLL). The left and right pointers in nodes are to be used as previous… Read More
  The cost of a stock on each day is given in an array, find the max profit that you can make by buying and… Read More
Given a Binary Search Tree (BST) and a range [min, max], remove all keys which are outside the given range. The modified tree should also… Read More