Round 1: Online coding test on Cocubes.com Round 2: Q1. Linked list multiplication: Given two linked list that represents polynomial return a pointer to linked list which is multiplication of the two. struct node { int coeff; int exp; struct node*next; }; example: 4x(2)-2x+1 x-1 answer : 4x(3)-6x(2)+3x-1 Q2. Suppose when user chooses OxygenWallet as … Read More →

## Flipkart Interview Questions – Set 6

I had interview with Flipkart for SDE . There was two technical round both guys was cool and interview process was very nice when i got stuck they provide me hint. Round 1: Q1. You have a infinite stream of repeated number find top K frequent number from this stream and discussion on this question … Read More →

## Find the Missing Element in Arithmetic Progression

Problem: Find the missing number in an Arithmetic Progression. An Arithmetic Progression is defined as one in which there is a constant difference between the consecutive terms of a given series of numbers. You are provided with consecutive elements of an Arithmetic Progression. There is however one hitch: exactly one number from the original series … Read More →

## Find a Peak Element in Array

Question: A peak element in an integer array is defined as an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its index. The array may contain multiple peaks, in that case return the index to any one of the peaks is fine. … Read More →

## Check if Binary Tree is Height Balanced?

Given a binary tree, determine if it is height-balanced. A height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1. The solution presented is a recursive. Find the height of left and right subtrees and check the difference of … Read More →

## Paytm Interview Questions – Set 2

Crazyforcode has helped me a lot. In order to help other students I would like to share my experience. Tech Round 1: Q1. How will you balance a binary search tree? Q2. Implement two stack in an array . Interviewer was confused about questions so he doesn’t ask about it? Q3. The other question was … Read More →

## Macros vs Functions

Macros are pre-processed which means that all the macros would be processed before your program compiles. However, functions are not preprocessed but compiled. See the following example of Macro: Output: 10 See the following example of Function: Output: 10 In short, Macro features: Macro is Preprocessed No Type Checking Code Length Increases Use of macro … Read More →

## Depth-first search (DFS) – Algorithms and Data Structures

Depth-first search starts a graph’s traversal by visiting an arbitrary vertex and marking it as visited. On each iteration, the algorithm proceeds to an unvisited vertex that is adjacent to the one it is currently in. (If there are several such vertices, a tie can be resolved arbitrarily. As a practical matter, which of the … Read More →

## Rope Escape Puzzle

Puzzle: Jim is trapped at the top of a building which is 200m high. He has with him a rope 150m long. There is a hook at the top where he stands. Looking down, he notices that midway between him and the ground, at a height of 100m, there is a ledge with another hook. … Read More →

## N Queens – Backtracking Problem 2

BackTracking: Find a solution by trying one of several choices. If the choice proves incorrect, computation backtracks or restarts at the point of choice and tries another choice. It is often convenient to maintain choice points. In an exhaustive search algorithm you search every possible choice to reach to the goal state, however, the backtracking … Read More →

## Oyo Rooms Interview Questions – Set 1

I have been approached through consultancy. Interview Questions: Round 1: Q1. Given a matrix with cost of visiting each cell move from 0,0 to m,n in minimum cost when you can only move left or down. Q2. Given an array of integers, update the index with multiplication of previous and next integers, e.g. Input: 2 … Read More →

## Pascal’s Triangle

Given numRows, generate the first numRows of Pascal’s triangle. For example, given numRows = 5, Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ] The logic becomes apparent just by looking at the pattern, but the property of pascal’s triangle comes from coefficients in the binomial expansion. nCk = n-1Ck + n-1Ck-1 and nC0 =1

## What’s going on ?