i
OLX
Filter interviews by
I applied via LinkedIn and was interviewed in Jul 2022. There were 2 interview rounds.
Q1 - array questions.
Q2 - Graph questions.
Q3 - DP questions
Indexes in MySQL are used to improve query performance by allowing faster data retrieval.
Indexes are created on one or more columns of a table.
They work by creating a separate data structure that allows for faster data retrieval.
Indexes can be created using the CREATE INDEX statement.
Indexes can also be dropped using the DROP INDEX statement.
Indexes can be used to speed up SELECT, UPDATE, and DELETE statements.
Indexes ...
include_once and require_once are PHP functions used to include files. The difference is in how they handle errors.
include_once will only include the file once, and will not throw a fatal error if the file is not found
require_once will also only include the file once, but will throw a fatal error if the file is not found
Both functions are used to include files that contain functions or variables that are needed in the
Sessions and cookies are both used for maintaining user state, but sessions are server-side and cookies are client-side.
Sessions store user data on the server, while cookies store data on the client's browser
Sessions are more secure than cookies because the data is not accessible to the client
Cookies can be used for tracking user behavior and preferences
Sessions are typically used for authentication and authorization p...
To find missing number in an array of first n numbers.
Calculate the sum of first n numbers using formula n*(n+1)/2
Calculate the sum of given array using loop
Subtract the sum of array from sum of first n numbers to get the missing number
Design a database schema for a chat application with individual and group messaging.
Create a 'users' table with unique user IDs
Create a 'messages' table with message IDs, sender and receiver IDs, message content, and timestamp
Create a 'groups' table with unique group IDs and group names
Create a 'group_members' table with group ID and user ID to track group membership
Use foreign keys to link tables together
Consider inde
SQL query to retrieve all unread messages upon user sign in
Use a JOIN statement to combine the messages and user tables
Filter the results to only show messages that have not been read by the user
Use the user's sign in information to identify which messages are unread
I am excited to join OLX because of its innovative approach to online marketplaces and its commitment to customer satisfaction.
I am impressed by OLX's user-friendly platform and its ability to connect buyers and sellers from all over the world.
I am excited to work with a team of talented developers who are passionate about creating cutting-edge technology.
I believe that OLX's focus on customer satisfaction aligns with ...
I have faced difficulties in debugging complex code and managing project timelines.
Debugging complex code with multiple dependencies
Managing project timelines with changing requirements
Working with legacy code and outdated technologies
Collaborating with team members in different time zones
Dealing with unexpected bugs and errors
I report to the Technical Lead and am part of the development team.
I report to the Technical Lead
I am part of the development team
Our website receives an average of 10,000 unique visitors per day.
Our website has a steady flow of traffic with a consistent number of unique visitors per day.
We use Google Analytics to track our web traffic and analyze user behavior.
Our peak traffic times are during weekdays from 9am to 5pm.
We have noticed an increase in mobile traffic over the past year.
Our website's traffic is primarily driven by organic search and
I appeared for an interview in Aug 2017.
Merge Sort is a divide and conquer algorithm that sorts an array by dividing it into two halves, sorting them separately, and then merging the sorted halves.
Divide the array into two halves
Recursively sort the two halves
Merge the sorted halves
Find pairs of integers in a BST whose sum is equal to a given number.
Traverse the BST and store the values in a hash set.
For each node, check if (X - node.value) exists in the hash set.
If yes, add the pair (node.value, X - node.value) to the result.
Continue traversal until all nodes are processed.
Merge overlapping time intervals into mutually exclusive intervals.
Sort the intervals based on their start time.
Iterate through the intervals and merge overlapping intervals.
Output the mutually exclusive intervals.
Example: [(1,3), (2,6), (8,10), (15,18)] -> [(1,6), (8,10), (15,18)]
Different types of hashing and alternative for Linear Chaining
Different types of hashing include division, multiplication, and universal hashing
Alternative for Linear Chaining is Open Addressing
Open Addressing includes Linear Probing, Quadratic Probing, and Double Hashing
An AVL tree is a self-balancing binary search tree where the heights of the left and right subtrees differ by at most one.
AVL tree is a binary search tree with additional balance factor for each node.
The balance factor is the difference between the heights of the left and right subtrees.
Insertion and deletion operations in AVL tree maintain the balance factor to ensure the tree remains balanced.
Rotations are performed ...
Find the minimum number of squares whose sum equals to a given number n.
Use dynamic programming to solve the problem efficiently.
Start with finding the square root of n and check if it is a perfect square.
If not, then try to find the minimum number of squares required for the remaining number.
Repeat the process until the remaining number becomes 0.
Return the minimum number of squares required for the given number n.
Insertion sort for a singly linked list.
Traverse the list and compare each node with the previous nodes
If the current node is smaller, swap it with the previous node
Repeat until the end of the list is reached
Time complexity is O(n^2)
Reverse a binary search tree while maintaining parent-child relationship.
Start by swapping the left and right child of each node recursively.
Use a depth-first search approach to traverse the tree.
Make sure to update the parent-child relationships accordingly.
To find min and max element in stack in O(1), we can use an auxiliary stack.
Create an auxiliary stack to keep track of the minimum and maximum elements.
Push the first element to both the main and auxiliary stack.
For each subsequent element, compare it with the top element of the auxiliary stack and push the smaller element to the auxiliary stack.
To get the minimum element, simply return the top element of the auxiliary...
Given an array, find the next minimum element for each element.
Iterate through the array
For each element, compare it with the elements on its right
Find the minimum element greater than the current element
If no such element exists, assign -1
Build the resultant array
Find median of input stream in minimum time complexity using online algorithm.
Use two heaps, one max heap for elements smaller than current median and one min heap for elements greater than current median.
Maintain balance between the two heaps by ensuring that the size difference is at most 1.
If the size of both heaps is equal, median is the average of the top elements of both heaps. Else, median is the top element of ...
To make a copy of a linked list with two pointers, iterate through the original list and create a new node for each element.
Iterate through the original linked list
Create a new node for each element
Set the 'next' pointer of each new node
Set the 'arbitrary' pointer of each new node
Reverse the nodes of a linked list in pairs of n
Iterate through the linked list in pairs of n
Reverse the nodes within each pair
Connect the reversed pairs together
Handle cases where the number of nodes is not a multiple of n
To check if a singly linked list is a palindrome, reverse the second half and compare it with the first half.
Traverse the linked list to find the middle node
Reverse the second half of the linked list
Compare the reversed second half with the first half to check for palindrome
Given a preorder of binary tree with leaf nodes represented by N, construct the tree.
Start by creating an empty stack.
Iterate through the preorder list.
If the current element is N, create a leaf node and push it onto the stack.
If the current element is not N, create a new node and set its left child to the top of the stack.
Pop the top of the stack and set it as the right child of the new node.
Push the new node onto the...
The question asks to find the maximum occupancy word in each line of a given multiline string and also count the occupancy of capital and small letters separately.
Split the multiline string into individual lines
For each line, split it into words
Initialize variables to store the maximum occupancy word and its count
Iterate through each word and count the occupancy of each letter
If the current word has a higher occupancy ...
Algorithm to find the best buying and selling dates for maximum profit from given stock prices array.
Iterate through the array and keep track of minimum price and maximum profit.
If current price is less than minimum price, update minimum price.
If current price minus minimum price is greater than maximum profit, update maximum profit and buying and selling dates.
Return buying and selling dates.
Example: [10, 7, 5, 8, 11,...
The code finds the number of ways to reach n steps by jumping 1 or 2 steps at a time.
Use dynamic programming to solve the problem
Create an array to store the number of ways to reach each step
Initialize the array with base cases for 0 and 1 steps
Iterate through the array and calculate the number of ways for each step
Return the value at the last step
Amazon.com is an online retail giant with a vast selection of products and services.
Advantages: Wide selection of products, competitive pricing, fast shipping, convenient shopping experience
Disadvantages: Can put smaller retailers out of business, concerns over worker treatment and environmental impact
Example: Amazon Prime offers free two-day shipping and access to streaming services like Prime Video and Music
Example: ...
Use file locking mechanisms like flock or lockfile to make a file mutually exclusive on a shared file system.
Use flock or lockfile to acquire a lock on the file before accessing it.
Release the lock once the operation is complete.
Ensure all processes accessing the file use the same locking mechanism.
Example: flock /path/to/file -c 'command to execute'
Example: lockfile /path/to/file && command to execute && rm -f /path/t
I am a software developer with 5 years of experience in developing web applications using Java and JavaScript.
5 years of experience in software development
Proficient in Java and JavaScript
Developed web applications
Strong problem-solving skills
Experience with agile development methodologies
Positive: Strong problem-solving skills, Negative: Can be overly critical of own work
Positive: Strong problem-solving skills - I excel at breaking down complex problems and finding efficient solutions
Negative: Can be overly critical of own work - I tend to be perfectionistic and struggle with accepting imperfections
I had a failure in implementing a new feature due to a lack of understanding of the requirements.
I was assigned to develop a new feature for our software application.
I misunderstood the requirements and implemented the feature incorrectly.
During the testing phase, it was discovered that the feature was not functioning as expected.
I took responsibility for the mistake and immediately communicated it to my team lead.
I wo...
Replace every element in array with its closest maximum element in right.
Iterate through the array from right to left
Keep track of the maximum element seen so far
Replace each element with the maximum element seen so far
Designing a distributed Hashtable and discussing its pros and cons.
Distributed Hashtable is a data structure that stores key-value pairs across multiple nodes.
Pros include scalability, fault tolerance, and load balancing.
Cons include increased complexity, potential for data inconsistency, and slower performance due to network communication.
Examples of distributed Hashtable implementations include Cassandra, Riak, and D
To identify if a tree is a BST, check if the inorder traversal of the tree results in a sorted sequence.
Perform an inorder traversal of the tree
Check if the resulting sequence is sorted in ascending order
If yes, the tree is a BST; otherwise, it is not
My favorite subject is computer science and I excel in problem-solving and algorithm design.
Computer science is my favorite subject because I enjoy coding and creating software applications.
I am best at problem-solving, as I have a strong analytical mindset and can efficiently break down complex issues.
I excel in algorithm design, as I have a deep understanding of data structures and can optimize code for efficiency.
Paging is a memory management technique used by operating systems to manage memory more efficiently. Virtual memory is a technique that allows a computer to use more memory than it physically has available.
Paging divides memory into fixed-size blocks called pages.
Virtual memory allows programs to use more memory than is physically available by temporarily transferring pages of data from RAM to disk.
Virtual memory also ...
The remaining memory is not wasted, but reserved for other system processes and applications.
The operating system reserves a portion of the RAM for its own processes and functions.
The unused memory can be used for caching data, improving system performance.
Applications and processes may not require the full amount of RAM at all times.
The unused memory can be allocated to other applications when needed.
Virtual memory an...
Return the total possible positions for a knight on a chess board given the number of combinations of moves.
Calculate all possible positions for a knight on a chess board using its unique L-shaped moves.
Consider the boundaries of the chess board while calculating the positions.
The total possible positions for a knight on a chess board are 64.
Use file locking mechanism to ensure mutual exclusion.
Implement file locking mechanism to prevent simultaneous access to files.
Use semaphores or mutexes to ensure only one process can access a file at a time.
Implement a queue system to handle multiple requests and process them one by one.
Use transactional file systems to ensure atomicity of file operations.
Implement a timeout mechanism to prevent deadlocks.
Consider imp...
Implementing a hash table in code
Choose a hash function to map keys to indices in the table
Create an array to hold the values at each index
Handle collisions by using a collision resolution strategy
Implement methods for inserting, retrieving, and deleting values
Consider load factor and resizing the table if necessary
The given question asks to replace the value in each node of a binary search tree with the sum of all nodes greater than the current node.
Traverse the BST in reverse order (right, root, left)
Keep track of the sum of all greater nodes encountered so far
Update the value of each node with the sum and update the sum
The next inorder predecessor in a binary search tree (BST) is the node with the largest value smaller than the given node.
In a BST, the inorder predecessor of a node is the rightmost node in its left subtree.
If the left subtree of the given node is empty, then the inorder predecessor is the nearest ancestor whose right child is also an ancestor of the given node.
If there is no inorder predecessor (i.e., the given node
Generate all possible parentheses for a given integer n.
Use recursion to generate all possible combinations of parentheses.
Start with an empty string and keep adding opening and closing parentheses.
Keep track of the number of opening and closing parentheses used.
Stop recursion when the number of opening and closing parentheses reaches n.
Add the generated combination to the result array.
The question asks how to feed a 2D matrix with values based on the given binary tree.
Traverse the binary tree and for each node, update the corresponding row in the matrix
Use a recursive function to update the matrix values
Start with the root node and recursively update its descendants
Set M[i, j] to 1 if node i is an ancestor of node j
Repeat the process for all nodes in the binary tree
Find the first occurrence of a given key element in a sorted array with duplicates.
Use binary search to find the key element.
If the key element is found, check if it is the first occurrence by checking the previous element.
If the key element is not found, return -1.
Spiral order traversal of a binary tree
Use a stack and a queue to traverse the binary tree in a spiral order
Start with the root node and add it to the stack
While the stack is not empty, pop a node from the stack and add its children to the queue
If the stack is empty, swap the stack and queue
Repeat until both stack and queue are empty
Queue can be implemented using two stacks by maintaining the order of elements.
Use two stacks, one for enqueue operation and one for dequeue operation
When enqueue is called, push the element onto the enqueue stack
When dequeue is called, if the dequeue stack is empty, transfer all elements from enqueue stack to dequeue stack
Pop the top element from the dequeue stack and return it as the dequeued element
Edit distance problem is a dynamic programming problem to find the minimum number of operations required to transform one string into another.
The problem can be solved using dynamic programming approach
The solution involves filling up a matrix of size (m+1)x(n+1)
The matrix represents the minimum number of operations required to transform one string into another
The operations include insertion, deletion and substitution
...
To find a loop in a linked list, we can use the Floyd's cycle-finding algorithm.
Initialize two pointers, slow and fast, both pointing to the head of the linked list.
Move slow pointer by one step and fast pointer by two steps at each iteration.
If there is a loop, the slow and fast pointers will eventually meet.
To prove the algorithm, we can use mathematical induction and the concept of tortoise and hare.
Return all root to leaf node paths of a binary tree with row, col and value.
Traverse the binary tree recursively and keep track of the current path.
When a leaf node is reached, add the path to the result.
Include row, col and value of each node in the path.
Use a data structure like a list or array to store the paths.
Consider edge cases like empty tree or single node tree.
Use an auxiliary stack to keep track of the maximum element at each step.
Create an auxiliary stack to store the maximum element at each step.
When pushing an element onto the main stack, compare it with the top element of the auxiliary stack.
If the new element is greater, push it onto the auxiliary stack.
When popping an element from the main stack, also pop the top element from the auxiliary stack if they are equal.
To g...
Implement a getMax() function for a queue that returns the maximum element in O(1) time complexity.
Maintain a separate data structure (e.g., a max heap) to track the maximum element in the queue.
Whenever an element is enqueued, compare it with the current maximum and update if necessary.
When dequeuing, check if the dequeued element is the maximum and update the maximum if needed.
Find the Next Greatest Element to the right for each element in an array.
Iterate through the array from right to left
Use a stack to keep track of elements
Pop elements from stack until a greater element is found
If no greater element is found, assign -1
Reverse the result array
Remove unnecessary parenthesis from an expression.
Identify the innermost expression enclosed in parenthesis.
Check if the parenthesis are necessary for evaluation.
If not, remove the parenthesis and repeat the process.
Stop when no more unnecessary parenthesis are found.
Find the maximum product of three integers in an array.
Sort the array in descending order.
Check the product of the first three numbers and the product of the first and last two numbers.
Return the maximum product.
Handle negative numbers by checking the product of two smallest negative numbers and the largest positive number.
The length of the longest consecutive subarray forming an arithmetic progression in an array of integers.
Iterate through the array and keep track of the longest consecutive subarray forming an AP.
Use a hashmap to store the difference between each element and the previous element.
If the difference is the same as the previous difference, increment the length of the current subarray.
If the difference is different, update ...
based on 2 reviews
Rating in categories
Key Account Manager
149
salaries
| ₹3.2 L/yr - ₹8.6 L/yr |
Dealer Success Manager
149
salaries
| ₹3 L/yr - ₹6.3 L/yr |
Accounts Manager
109
salaries
| ₹2.7 L/yr - ₹6.8 L/yr |
Senior Accounts Manager
70
salaries
| ₹3.9 L/yr - ₹8 L/yr |
Retail Associate
65
salaries
| ₹2.9 L/yr - ₹6 L/yr |
Quikr
eBay
Tokopedia
Amazon