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 →
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
Cut Painted Cube Puzzle
Puzzle: A solid, four-inch cube of wood is coated with blue paint on all six sides. Then the cube is cut into smaller one-inch cubes. These new one-inch cubes will have either three blue sides, two blue sides, one blue side, or no blue sides. How many of each will there be? Puzzle Solution: Subtract … Read More →
Secret Mail Problem
Puzzle: A wants to send a secret message to his friend B in the mail. But C (A’s Friend), who A don’t trust, has access to all A’s mail. So A put his message in a box with a lock. But A is not allowed to send a key! How can A send his message … Read More →
Set every cell in matrix to 0 if that row or column contains a 0
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. This problem should be solved in place, i.e., no other array should be used. We can use the first column and the first row to track if a row/column should be set … Read More →
Grofers Interview Experience – Set 1
Recently I am interviewed for Grofers SDE-1 position in Gurgaon. Round 1 (40 mins) Thorough discussion about the projects. My major work was on LAMP stack and since the projects were live, so the interviewer kept on grilling me. Questions on the database, challenges faced, control flow were asked. He even asked the implementation of … Read More →
Urbanclap Interview Experience – Set 1
I applied through recruiter. The process took two days and Questions asked was both algorithm based and design based.Interviewer was very Helpful and Friendly.Culture and Working Environment is very Nice. Interview Questions: Q1. Intro about me and my current work. Q2. Work experience in android. Q3. Asked me to tell about the app I am … Read More →
What’s going on ?