143811flipkart interview guide, Exercises of Advanced Computer Programming

Flipkart Study Guide

Typology: Exercises

2014/2015

Uploaded on 08/24/2015

Paras.Mishra
Paras.Mishra ๐Ÿ‡ฌ๐Ÿ‡ง

4

(2)

1 document

1 / 33

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
INTERVIEW
BIBLE
TOPTALENT.IN
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21

Partial preview of the text

Download 143811flipkart interview guide and more Exercises Advanced Computer Programming in PDF only on Docsity!

INTERVIEW

BIBLE

TOPTALENT.IN

Index

1. Why Flipkart?

2. Interview Process

3. Online Coding Questions

4. Telephonic Interview Round I

Questions

5. Telephonic Interview Round II

Questions

6. Personal Interview I / Machine

Coding Round Questions

7. Personal Interview II Questions

8. Sample Resume I

9. Sample Resume II

A Typical interview process for Software Development Engineer is divided into 4 rounds

  • Online Coding
  • Two Rounds of Technical Interview
  • One Round of HR + Technical interview. Generally if you applied Off-campus you will be facing two Telephonic rounds after the Online Coding round. Online Coding :- Two coding questions will be given and should be answered in 90 minutes only. Generally, we have to complete the function only. Technical Interview :- There will be two rounds of technical interview. The two rounds are similar in their difficulty. The first Technical round centers more on Machine Learning and coding. The second Technical round focuses more on Data Structures and Algorithms. There will be time limit for both the rounds depending on the type of questions. HR interview :- This round is mostly about your knowledge of Flipkart and questions about your resume and a few technical questions Interview Process

Sample Questions

Online Coding Questions :-

1 - Given a mxn grid, each of its element be either โ€˜.โ€™, โ€˜Rโ€™, โ€˜Gโ€™ or โ€˜Bโ€™, where โ€˜.โ€™ - > empty, โ€˜Rโ€™ - > Red, โ€˜Gโ€™ - > Green, โ€˜Bโ€™ - > Blue A Blue strip has width 1 and length greater or equal to one. A Red strip has length 1 and width greater or equal to one. If a Red strip and a Blue strip overlaps, the overlapped portion will become โ€˜Gโ€™. Find the minimum number of strips required to cover the whole grid. 1<= m,n <= Ex. Input 2 4 ..B. ..B. Output 1 Explanation: Blue strips are vertical. Red strips are horizontal. Ex 1: Only 1 vertical strip from (0,2) to (1,2). [Indexing from (0,0)] Ex 2: 1 vertical strip from (0,2) to (2,2) 1 horizontal strip from (1,2) to (1,4) 1 horizontal strip from (3,0) to (3,0) 1 horizontal strip from (4,0) to (4,0) so total โ€” 4 Input 5 5 ..B.. ..GRR ..B.. R.... R.... Output 4 Input 5 5 ..B.. ..GRR ..B.. B.... B...G Output 5

Sample Questions

Online Coding Questions :-

Example: For the graph in diagram, A dependencies: C,D i.e. 2 B dependencies: D i.e. 1 C dependencies: D i.e. 1 And D depends on none. Hence answer=0+1+1+2=4. 5 - At Flipkart, an employee has many subordinates. But an employee can also have many managers. And a manager can further have more managers overseeing his work. A simple "boss-employee-relationship- can be denoted by an arrow '-->' A --> B --> C This denotes that A is direct boss of B, who is direct boss of C. Here A is also (indirect) boss of C. It is guaranteed that there is no cycles in this relationship. That is there exists no pair of employees, X and Y, such that X is boss of Y and Y is also boss of X. The salary of an employee can be calculated on the basis of following rules:

  • an employee like C who has no subordinates earns 1.
  • An employee who has direct subordinates earns a salary equal to the sum of his direct subordinates' salaries.

Sample Questions

Online Coding Questions :-

"relations" denotes a array of strings, where if the jth character of ith^ string is Y, if employee i is a direct boss of employee j. Otherwise it is "N". You have to display the sum of salaries of all employees. Complete this function in the code editor int Summing(String[] relations) Constraints The size of relations array will not have elements greater than 50. the arrays will only contain string composed of "Y" & "N" each element of the array has same number of characters For k th row. the k th element will always be "N" If X is boss of Y. Y cannot be a boss or X. Test cases are designed such that answers will always lie within the range of signed 32bit int. Sample Case # Input Returns: 1 Explanation: There is only one employee, so his salary will be 1. Sample Case # Input NNYN NNYN NNNN NYYN Returns: 5 Explanation: It has the following relation. 4 |
1 | 2 \ | / 3 So salary of 3rd employee is 1, 1st and 2nd employee is equal to the sum of its (only) employee (3rd) which is 1. Salary of 4th employee is sum of salary of 2nd and 3rd employee which is 1 + 1 2. So total salary is 2 + 1

  • 1 +1 = 5.

Sample Questions

Online Coding Questions :-

6 - A person wants to go from origin to a particular location, he can move in only 4 directions(i.e East, West, North, South) but his friend gave him a long route, help a person to find minimum Moves so that he can reach to the destination. Input โ€“ NESNWES Output โ€“ E You need to print the lexicographically sorted string. Assume the string will have only โ€˜Eโ€™ โ€˜Nโ€™ โ€˜Sโ€™ โ€˜Wโ€™ characters. E.g. โ€“ SSSNEEEW output โ€“ EESS 7 - A sender will send a binary string to a receiver meanwhile he encrypt the digits. You are given a encrypted form of string. Now, the receiver needs to decode the string, and while decoding there were 2 approaches. First, receiver will start with first character as 0; S[0] = 0, P[1] = S[1] + S[0], P[2] = S[2] + S[1] + S[0] and so on. Second, Receiver will start with first character as 1; S[0] = 1, P[1] = S[1] + S[0], P[2] = S[2] + S[1] + S[0] and so on. You need to print both the strings, after evaluation from both first and second technique. If any string will contain other that binary numbers you need to print NONE. Input1; 0123210 Output: 0111000 NONE explanation for NONE โ€“ S[0] = 1, P[1] = S[1] + S[0] so S[1] = 0 P[2] = s[2] + S[1] + S[0] , S[2] = 1 P[3] = S[3] + S[2] + S[1], S[3] = 2, not a binary character so NONE

Sample Questions

Online Coding Questions :-

8 - Main DNA sequence(a string) is given (let say strDNA) and another string to search for(let say strPat). You have to find the minimum length window in strDNA where strPat is subsequence. 9 - There is a zoo and there are several groups (number of groups:K) of people for tour. Each group is having different size (g1,g2,g3โ€ฆgK). There is one bus with capacity C. Journey starts from a point and bus will come back to the same point. A group can only be included in the bus if all the members of the groups can be accumulated in bus. After coming back from the tour, each group in the bus will again wait in the queue at the bus-stand. Bus-driver earns a rupee for each person travelled. You have to find the earning of the bus driver after R rounds. For example : Number of groups G = 4 Group size for each group : 2 4 3 5 Bus capacity : 7 Number of rounds R : 4 queue : (from front side) 2 4 3 5 First round : 2 4 (we canโ€™t take 3rd group as 3 members canโ€™t be accumulated after 2 and 4.) queue : 3 5 2 4 (1st and 2nd group are enqueued. i.e. 2 and

Second round : 3 queue : 5 2 4 3 Third Round : 5 2 queue : 4 3 5 2 Fourth Round : 4 3 After 4 rounds, total earning is 6+3+7+7 = 23.

Sample Questions

Telephonic Interview Round I Questions :-

1 - Find the square root of a given integer. e.g. 27 output should be 5, for 32 output should be 6. 2 - Given a 2D matrix of integers find the maximum sum path in the matrix. 3 - Solve Snakes and ladder problem, Given all the inputs for the board. You can roll the dice, as you want to. Need to find the shortest path to reach the 100 level from the starting of the path. 4 - Given a file with millions of words, need to find top K words on the basis of occurrence 5 - Print the left view of a tree. 6 - Given set of words that are lexographically sorted, find the grammar. E.g.: abc acd bcc bed bdc dab The order of letters for the given example would be a->b->c->e->d 7 - Generate all numbers in ascending order which are having factors as 2,3 and 5. Discuss various approaches. 8 - Check whether given Binary Tree is a Binary Search Tree. Discuss various approaches. 9 - Given an array of n distinct integers sorted in ascending order. Find an index i s.t ar[i] = i. Return - 1 if no such index exists. Note that integers in array can be negative. 10 - Design a stack which holds an integer value such that getMinimum() function should return the minimum element in the stack.

Sample Questions

Telephonic Interview Round I Questions :-

FOLLOW UP: Implement popMin() function which would pop minimum element from the original stack. O(1) implementation was required.(Hint: Use Linked List to implement stack and store address of minimum element node in min-stack) 11 - Print an organizational hierarchy. Naveen manages Satish Satish manages Anushree Satish manages Sandeep Gurinder manages Naveen Gurinder->Naveen Naveen->Satish Satish->Anushree,Sandeep Anushree-> Sandeep->

Sample Questions

Telephonic Interview Round II Questions :-

9 - In a client-server architecture, there are multiple requests from multiple clients to the server. The server should maintain the response times of all the requests in the previous hour. What data structure and algorithm will be used for this? Also, the average response time needs to be maintained and has to be retrieved in O(1). 10 - Given N meetings with their start time s1, s2 โ€ฆ.sn and end time e1, e2 โ€ฆ.en and K rooms. How to schedule maximum of N meetings in k rooms. 11 - Given an array which is first strictly increasing and then strictly decreasing. Find an element in this array.

Sample Questions

Personal Interview I / Machine Coding Round

Questions :-

1 - You are given a sorted array of size 7 but only 4 elements in it and a sorted array of 3 elements. How would to combine the elements into the first array in such a way that array is sorted. 2 - How do you find if a string is a palindrome or not? 3 - Given a corrupted string i.e. its original string with just the spaces at wrong places, Construct the original string .You are given a dictionary of words. Ex:- string : Com put erengineering original string: Computer Engineering 4 - Given a lane where there are various houses each containing a fixed amount of gold. Now a robber has to rob the houses such that when he robs a house the adjacent one cannot be robbed. Calculate the maximum amount of gold collected by him. 5 - Given 1000 elephant ,none of whom exact heights are known, there are statements given which will be of two forms 3.i-E_i is taller than E_j OR 3.ii-E_i is smaller than E_j Calculate the ascending order of the elephants(in terms of height). 6 - Topologically sort the DAG(excluding forest arrangement) given if the source is not known. For Ex: if edges are 1->2,1->3,2->4,3->.

Sample Questions

Personal Interview I / Machine Coding Round

Questions :-

  • if a string length is big enough, so that it cannot be printed in single line, use โ€˜-โ€™ in the end of the line and print string further in the different line.
  • also there should not be โ€˜โ€“โ€™ consecutively in the end, if the string contains already โ€˜-โ€™ in the end don't put โ€˜-โ€™ character. E.g. flip-kart and if x = 5 so it should be - > flip- kart
  • the string should not start with these characters(โ€˜.โ€™ , โ€˜,โ€™ โ€˜ โ€˜)
  • the cost value should be minimum, there can not be multiple answer for a single string. E.g.. This is a flipkart online programming test. x = 10 Y = 3 Output This is a flipkart online pr- ogramming test. 10 - Create an employee database structure in which Employee has id, name, manager. Three functionalities required were a) Given any id return all the employee details b) Given any name(or id) list all the subordinates of the given employee. c) Given a name search with prefix search property.

Sample Questions

Personal Interview I / Machine Coding Round

Questions :-

11 - Write code to parse an XML and do the following options by not hardcoding any value.

  1. Validate the XML.
  2. Given a level number, print all values of tags in the same level.
  3. Search
  • a tag name for a given value
  • for value of any tag given a value of tag at any sub levels. 12 - Given a string regex and another string pat find whether the pattern is acceptable against given regex string. Regex string contains following characters and special characters: Normal alphabets โ€“ a to z and A to Z
  • โ€˜$โ€™ โ€“ all string should end with all characters preceding $ Example: Regex :abc$ , Pattern: abcd(Not acceptable) , abc(acceptable), ab(Not acceptable), dhfusdhabc(acceptable) etc..
  • โ€˜^โ€™ โ€“ all string should start with all characters exceeding ^ Example: Regex : ^abc Pattern: abcd(acceptable) , abc(acceptable), ab(Not acceptable), dhfusdhabc(NOT acceptable) etc.. Regex: ^ then only pattern acceptable is null.
  • โ€˜.โ€™ โ€“ any character can be mapped to dot except null Example 1: Regex : .abc Pattern: Zabc(acceptable) , abc(NOT acceptable), ab(Not acceptable), habc(acceptable) etc.. Example 2: Regex :a.bc Pattern: abc(NOT acceptable) , aXbc(acceptable), ab(Not acceptable), habc(NOT acceptable) etc..