**About Flipkart**

Flipkart Private Limited is an Indian e-commerce company established in 2007. The company is headquartered in Bangalore, Karnataka, India incorporated in Singapore as a private limited company. Flipkart started with a prime focus on online book sales and soon expanded to different product categories such as lifestyle products, electronics, home essentials, home groceries and fashion. Today, Flipkart is the biggest online Indian marketplace competing with the world leader Amazon. Since 2010, the company has acquired Myntra, Jabong, eBay India, etc. This blog on ” Flipkart Interview Questions” helps you to practice the questions asked at Flipkart.

**Flipkart Recruitment Process**

The Selection Process Is Based On The Post You Are Applying For How Ever For Entry Level Position In Flipkart Recruitment Selection Process There Mainly divided on to below steps as follows

- Online Coding or Telephonic round
- Multiple Technical Rounds
- Hiring Manager Round
- HR Interview Round

**Online Coding Round/ Telephonic round:**

The online round is hosted on Hackerrank and in this round, the candidates are given around 3 coding questions, of which 2 are easy and 1 is hard. The number of questions may vary the difficulty distribution is the same. The whole round is around 60 minutes long. Problems are generally based on recursion, strings, trees and graphs.

**Technical Round 1:**

Personal interview round which largely consists of algorithmic problems on DS like graphs, dp, matrices and strings. Many times puzzles are also asked, though standard puzzles, some variation may be there. A strong understanding of data structures is needed to pass this round.

**Technical Round 2:**

This round generally is a machine coding round, in which a particular problem is given whose solution is to be built from scratch in any language of choice, ex: job scheduling problem, implementing a complete text line editor with specified features. The round is of ~90 mins and a complete working code with error handling is expected at the end.

**Hiring Manager round:**

This round mainly consists of hard algorithmic and DS related problems, mostly from trees, graphs and linked lists, along with the discussion of your projects, the technologies used in them, the problems faced etc. Some conceptual problems related to OS are also asked.

**HR Interview Round:**

You can expect HR questions like :

2. Your shortcomings and strengths.

3. Discussion regarding your post in the company

**Eligibility Criteria**

The eligibility criteria for the fresher to join Flipkart is 60% means in 10th, 12th and in Graduation. Candidates should not have any pending backlogs at the time of appearing for the Flipkart Recruitment process.

Other requirements include:

Candidates must Be Flexible To Work In Shifts.

Candidates Must Have Good Communication Skills.

Candidates Must Have A Good Hold On Mathematics Or Must Be Good In Calculation.

Candidates must Have Good Academic Records From Class X On Wards.

Candidates Who Have Attended Flipkart Interview Or Recruitment Before 6 Months Need Not Apply.

**Flipkart Interview Questions**

**Which is the fastest method to sort an almost sorted array?**

This is one of the important Flipkart Interview Questions

There are a lot of sorting algorithms like insertion sort, bubble sort, merge sort, selection sort, heap sort, and quicksort.The array is almost sorted. The best-preferred method is the insertion sort as shown in the below program one can infer that insertion sort is the fastest method. This code uses the time in the python library to depict the total execution time for insertion sort and merge sort.

```
#Importing Library
import timeit
Insertionsort = '''
def insertion_sort():
insert_arr = [4, 5, 7, 6]
for i in range(1, len(insert_arr)):
# Set key:
key = insert_arr[i]
j = i - 1
while j >= 0 and insert_arr[j] > key:
# Swap:
insert_arr[j + 1] = insert_arr[j]
insert_arr[j] = key
# Decrement 'j':
j -= 1
'''
Mergesort = '''
def merge_Sort():
myList = [4, 5, 7, 6]
if len(myList) > 1:
mid = len(myList) / 2
left = myList[:mid]
right = myList[mid:]
# Recursive call on left and right half
merge_Sort(left)
merge_Sort(right)
# 2 iterators for traversing the two halves and one iterator for main list
i = 0
j = 0
k = 0
while i < len(left) and j < len(right):
if left[i] < right[j]:
# The left half value is used
myList[k] = left[i]
# Moving the iterator forward
i += 1
else:
myList[k] = right[j]
j += 1
# Moving to the next slot
k += 1
# For all the other remaining values in list
while i < len(left):
myList[k] = left[i]
i += 1
k += 1
while j < len(right):
myList[k]=right[j]
j += 1
k += 1
'''
print("Insertion sort:")
print(timeit.timeit(stmt=Insertionsort,number=10000000))
print("Merge sort:")
print(timeit.timeit(stmt=Mergesort,number=10000000))
```

However, merge sort is preferred when the order of input on not known and the worst-case time complexity is nlogn. Whereas bubble sort time complexity of n and quick sort gives complexity of n^2.

**What is a hash table? Explain how hash functions and buckets work.**

A hash table or hash map is a data structure that provides direct access to objects based on a key. It is a structure that can map keys to values. Hash tables implement an associative array, which is indexed by arbitrary objects (keys). A hash table uses a hash function (is used to map data of random size to fixed-size values.)to compute an index, also called a hash value, into an array of buckets or slots, from which the desired value can be found.

The main features of the key (a unique string or integer)used:

The key used can be your Social security Number, your telephone number, bank account number, etc

Keys must always be unique

Each key is always mapped to its associated a value

Few properties of Hash Functions are:

Computation is very fast (almost constant)

Cannot be reversed it is unidirectional

Input information is hidden output doesn’t reveal inputs information

Hard to find collisions (different data with the same hash)

Implementation is built using parity-preserving bit operations (XOR and ADD), multiply, or divide.

Hash buckets are used to allocate data items for sorting or lookup purposes. The aim is to weaken the linked lists so that searching for a particular item can be accessed within a shorter time frame.

A hash table that uses buckets is a combination of an array and a linked list. Each element in the array i.e. The hash table is a header for a linked list. All elements in the array that hash into the same location will be stored in the list. The hash function allocates each record to the first slot within one of the buckets. If the slots are occupied, then the bucket slots will be searched sequentially until an open slot is found. If the bucket is completely filled, the record will get stored in an overflow bucket of infinite capacity at the end of the table. All buckets share the same overflow bucket. However, a good implementation will use a hash function that distributes the records evenly among the buckets so that as few records as possible go into the overflow bucket.

**In the given array of integers, find Pythagorean triplets.**

This is one of the important Flipkart Interview Questions

A Pythagorean triplet is a set {a, b, c} such that a2 = b2+ c2. The user will be provided with an array of integers and has to identify all the possible sets of Pythagorean triples.

Algorithm

We can solve the problem by sorting the given array in ascending order, first in O(n2).

The steps involved would be:

- Square every element in the given array and then sort it in ascending order.
- Since the array now contains squares, the new equation for triplet becomes a = b + c. Now fix ‘a’ to be the last element of this sorted array,
- Fix b as the first element of the sorted array and c as the element right before element a. Since numbers are positive and the array is sorted, b<a and c < a. To find triplets, run a loop that increases b from 1.
- Increase the position of b if b + c < a
- Decrease the position of c if b + c > a
- If the sum is equal to a, then print the square root of the three numbers, increment b, and decrement c.
- Repeat the last step for each element a in the array.

```
import java.io.*;
import java.util.*;
import java.lang.Math;
class PythagoreanTriplet {
static void find_Triplet(int arr_trip[], int n)
{
// Step1 squaring every element in an array
for (int i = 0; i < n; i++)
arr_trip[i] = arr_trip[i] * arr_trip[i];
Arrays.sort(arr_trip);
// Step2 and Step 3 fixing element a b and c and sorting array
for (int i = n - 1; i >= 2; i--) {
int b = 0;
int c = i - 1;
while (b < c) {
// if triplet found
if (arr_trip[b] + arr_trip[c] == arr_trip[i]) {
System.out.printf("Triplets are: %f, %f, %f\n", new Object[] {Math.sqrt(arr_trip[b]), Math.sqrt(arr_trip[c]), Math.sqrt(arr_trip[i])});
b++;
c--;
}
if (arr_trip[b] + arr_trip[c] < arr_trip[i])
b++;
else
c--;
}
}
}
// Main code
public static void main(String[] args)
{
int arr_trip[] = { 3, 7, 4, 6, 5 };
int arr_trip_size = arr_trip.length;
find_Triplet(arr_trip, arr_trip_size);
}
}
```

**Compute the nearest palindrome number of the given number.**

The problem statement is if for a given number task is to find the closest palindrome number.

For example, if the number entered is say 43 then there are two numbers that must display the closest palindrome number which is 44.

Below are a few solutions that can be considered.

Solution 1: If a number contains all 9’s digits then we can get the next closest Palindrome by simply adding 2 to it. num = 99 : output : num + 2 = 101.

Solution 2: Another possible way of getting the closest palindrome is to copy the first half of the number and add a mirror image at the end of it. Left half : For example, left side of “456789” is “456” and the left half of “456789” is “4 5”. To convert to a palindrome, we can take the mirror of its left half.

Let’s number: 456789

After copying the first half, append the reverse of it at the end number looks like:

we get palindrome 456654

Solution 3: Another possible way of getting the closest palindromic number is by decrementing and incrementing the middle digit by one on the palindrome.

**Conclusion **

The interview questions should be directed towards obtaining information about the job seeker’s ability to perform the duties of the job, as well as their motivation for wanting the position. The interviewer should also ask questions about the job seeker’s qualifications, work experience, and skills.