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 →

## Count Number of Bits to be Flipped to Convert A to B

Suppose, I have two numbers A and B. I need to find out how many numbers of bits needed to be changed to convert A to B. Like: A = 1101101 B = 1011011 ^^ ^^ Here, we need to change 4 bits to convert A to B How can I do this? Solution: 1. … Read More →

## Union and Intersection of two Linked Lists

Given two Linked Lists, create union and intersection lists that contain union and intersection of the elements present in the given lists. Order of elments in output lists doesn’t matter. Following are simple algorithms to get union and intersection lists respectively. Intersection (list1, list2) Initialize result list as NULL. Traverse list1 and look for its … Read More →

## What are the underlying data structures used for Redis?

Here is the underlying implementation of every Redis data type. – Strings are implemented using a C dynamic string library so that we don’t pay (asymptotically speaking) for allocations in append operations. This way we have O(N) appends, for instance, instead of having quadratic behavior. – Lists are implemented with linked lists. – Sets and … Read More →

## Redis Tutorial

Redis, developed in 2009, is a flexible, open-source, key value data store. Following in the footsteps of other NoSQL databases, such as Cassandra, CouchDB, and MongoDB, Redis allows the user to store vast amounts of data without the limits of a relational database. Additionally, it has also been compared to memcache and can be used, … Read More →

## Edit Distance – DP Problem

Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have the following 3 operations permitted on a word: a) Insert a character b) Delete a character c) Replace a character Input: str1 = “cat”, str2 = “cut” Output: … Read More →

## Graph Data Structure

Graphs A tree only allows a node to have children, and there cannot be any loops in the tree, with a more general graph we can represent many different situations. A very common example used is flight paths between cities. If there is a flight between city A and city B there is an edge … Read More →

## Distinct Subsequences

Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (ie, “ACE” is … Read More →

## Decode Ways Leetcode Java

Problem: A message containing letters from A-Z is being encoded to numbers using the following mapping: ‘A’ – 1 ‘B’ – 2 ‘Z’ – 26 Given an encoded message containing digits, determine the total number of ways to decode it. For example, Given encoded message “12″, it could be decoded as “AB” (1 2) or … Read More →

## What’s going on ?