PayPal
BigBasket Interview Questions and Answers
Q1. Input a file. Select first 3 lines of the file. Select the longest line and count the number of words in that line. It was easy. I used Java methods to solve the problem. I explained the logic and he accepted i...
read moreThe program reads a file and selects the first 3 lines. It then identifies the longest line and counts the number of words in that line.
Read the file using appropriate file handling methods
Store the first 3 lines in an array of strings
Iterate through the array to find the longest line
Count the number of words in the longest line using string manipulation methods
Q2. But amazon can do the search in O(n). Why it has to go for O(nk)? For data structures like Hash tables and for large data, n will be large. So O(nk) is better than O(n) (former n is smaller than latter n).
O(nk) is better than O(n) for large data and hash tables.
O(nk) is better because it takes into account the size of the data and the number of keys.
For large data and hash tables, the size of n will be large, making O(nk) more efficient.
O(n) assumes a constant number of keys, which may not be the case in practice.
Amazon may have chosen O(nk) for better scalability and performance.
Q3. When you search for a particular product in amazon, it displays some of the search results. But, only few particular products which are available in amazon are displayed, not all. How does this happen? I told M...
read moreAmazon displays only a subset of search results based on various factors like relevance, popularity, and user preferences.
Amazon uses algorithms to determine which products to display in search results.
Factors considered include product relevance, customer reviews, sales rank, and availability.
Machine learning techniques may be used to personalize search results based on user behavior and preferences.
Amazon also considers factors like seller reputation and fulfillment options...read more
Q4. There exists a 3x3 matrix, start from the first element reach the last element of the matrix, between each edges there exists a weight. Reach the destination such that the sum of weights should be small. It was...
read moreThe question is about finding the shortest path in a 3x3 matrix with weighted edges.
This is a graph traversal problem.
Use a graph algorithm like Dijkstra's algorithm or A* search to find the shortest path.
Assign weights to the edges and calculate the sum of weights for each possible path.
Choose the path with the smallest sum of weights as the shortest path.
Q5. What will be the key and what will be the values? The product will be the key. The brands will be the values.
The product will be the key and the brands will be the values.
The key in this case refers to the unique identifier for each product.
The values are the different brands associated with each product.
For example, if the product is a smartphone, the key could be the model number and the values could be the different brands that manufacture that model.
Q6. Do you know Radix Sort? Where it is used? Radix sort can be applied in amazon.
Radix sort is a sorting algorithm that sorts integers by processing individual digits from least significant to most significant.
Radix sort is a non-comparative sorting algorithm.
It sorts numbers by grouping them based on each digit's value.
It is commonly used for sorting strings in lexicographic order.
Radix sort has linear time complexity, making it efficient for large datasets.
Q7. What data structure do they use? Hash tables.
Hash tables are a data structure that uses a hash function to map keys to values, providing efficient lookup, insertion, and deletion.
Hash tables use a hash function to convert keys into array indices.
They provide constant-time average case complexity for search, insert, and delete operations.
Collisions can occur when different keys map to the same index, which can be resolved using techniques like chaining or open addressing.
Examples of hash table implementations include Pyt...read more
Q8. Application of Fibonacci series in day-to-day life.
The Fibonacci series can be applied in day-to-day life for various purposes.
Financial planning: Fibonacci numbers can be used to calculate investment growth and determine optimal investment strategies.
Architecture and design: Fibonacci ratios can be used to create aesthetically pleasing designs and layouts.
Nature and biology: Fibonacci patterns can be observed in the growth of plants, arrangement of leaves, and formation of shells.
Music and art: Fibonacci sequences can be use...read more
Q9. Running time of Radix sort? O(nk)
Radix sort has a running time of O(nk), where n is the number of elements and k is the length of the longest element.
Radix sort is a non-comparative sorting algorithm that sorts elements by their individual digits or characters.
It works by distributing the elements into 10 buckets based on the value of the least significant digit, then repeatedly redistributing them based on the next significant digit.
The process continues until all digits have been considered, resulting in a...read more
Interview Process at BigBasket
Reviews
Interviews
Salaries
Users/Month