Filter interviews by
Clear (1)
I applied via LinkedIn and was interviewed in Nov 2024. There was 1 interview round.
Top trending discussions
posted on 10 Mar 2015
Algorithm to find 2 numbers in an array whose sum is equal to a target integer
Use a hash table to store the difference between target and each element in the array
Iterate through the array and check if the current element exists in the hash table
Return the pair of elements that sum up to the target integer
Write a select statement to retrieve work of all users who belong to my team.
Join USERS and WORK tables on user_id
Join MANAGERS and USERS tables on team
Filter by manager_id
The manifest.json file contains the most important information of a Chrome extension.
The manifest.json file includes the version number, permissions, content scripts, background scripts, and other important details.
It is located in the root directory of the extension.
It is required for all Chrome extensions.
Example: "manifest_version": 2, "version": "1.0", "permissions": ["tabs", "storage"]
Hashtable is faster for finding an item than a sorted list.
Hashtable has constant time complexity O(1) for finding an item.
Sorted list has logarithmic time complexity O(log n) for finding an item.
Hashtable uses hashing to directly access the item's location.
Sorted list requires binary search to find the item's location.
Hashtable is ideal for large datasets with frequent lookups.
Sorted list is ideal for datasets that re
JSON and XML are the most popular data interchange formats when using APIs.
JSON (JavaScript Object Notation) is a lightweight format that is easy to read and write. It is widely used in web APIs.
XML (Extensible Markup Language) is a more complex format that is also widely used in web APIs.
Other formats include CSV (Comma Separated Values), YAML (YAML Ain't Markup Language), and Protocol Buffers.
Popular APIs for Social Commerce services
Facebook Graph API for social media integration
Instagram API for photo sharing and tagging
Twitter API for real-time updates and customer engagement
Pinterest API for product discovery and sharing
Google Maps API for location-based services
PayPal API for secure payment processing
Use a script to iterate through each HTML page, locate phone numbers, and update their format.
Write a script using a programming language like Python or JavaScript to iterate through each HTML page
Use regular expressions to locate phone numbers in the pages
Update the format of the phone numbers as needed (e.g. adding country code, changing separators)
Save the updated HTML pages with the new phone number format
Designing Google Suggest system
I would start by analyzing user search patterns and frequently searched keywords
Then, I would create a database of these keywords and their associated search results
I would use indexing services to quickly retrieve relevant results for each keyword
I would also implement machine learning algorithms to improve the accuracy of suggestions over time
Check if a number is a power of 2 and odd.
To check if a number is a power of 2, use bitwise AND operator with the number and its predecessor. If the result is 0, it is a power of 2.
To check if a number is odd, use modulus operator with 2. If the result is 1, it is odd.
Example code in Python:
def is_power_of_two(num):
return num & (num - 1) == 0
def is_odd(num):
return num % 2 == 1
By introducing new menu items, optimizing pricing strategy, and improving the overall dining experience.
Conduct a survey to understand the preferences of employees
Introduce healthy and affordable meal options
Offer discounts for bulk orders or loyalty programs
Partner with local vendors to source fresh ingredients
Improve the ambiance and seating arrangements
Implement online ordering and delivery services
Reviewing 30 million ads from 42 languages in Google AdWords and rejecting non-compliant ads requires a systematic approach.
Create a set of specific rules and guidelines for ad compliance
Use automated tools to filter out ads that violate the rules
Assign a team of reviewers to manually check the remaining ads
Ensure that the reviewers are fluent in the languages of the ads they are reviewing
Regularly update the rules and...
A generic swap function swaps two values of any data type.
The function should take two parameters of any data type.
Use a temporary variable to store the value of one parameter.
Assign the value of the second parameter to the first parameter.
Assign the value of the temporary variable to the second parameter.
Search for an element in a rotated sorted linked list.
Find the pivot point where the list is rotated.
Divide the list into two sublists based on the pivot point.
Perform binary search on the appropriate sublist.
Handle edge cases such as empty list and list with only one element.
Search an element in a rotated sorted array
Find the pivot point where the array is rotated
Divide the array into two sub-arrays based on pivot point
Perform binary search on the appropriate sub-array
Repeat until element is found or sub-array size is 1
Find 5 missing numbers in an array of size 95 containing numbers in range 1 to 100.
Create a boolean array of size 100 and mark the present numbers
Iterate through the boolean array and find the missing numbers
Alternatively, use a HashSet to store the present numbers and find the missing ones
Given a Sudoku board, find possible numbers for an empty cell.
Iterate through empty cells and check possible numbers using row, column, and box constraints.
Use a set to keep track of possible numbers for each empty cell.
Return the set of possible numbers for the given empty cell.
Find integer average of 4 unsigned integers without typecasting
Add all the integers and divide by 4
Use bit shifting to divide by 4
Handle overflow by using long long data type
Use unsigned int data type for input
Code to identify 32 bit or 64 bit architecture of a processor
Check if the operating system is 32 bit or 64 bit
If OS is 32 bit, processor is 32 bit
If OS is 64 bit, check if processor supports 64 bit architecture
Use CPUID instruction to check if processor supports 64 bit architecture
Convert binary number to base 64 integer
Divide the binary number into groups of 6 bits
Convert each group of 6 bits to decimal
Map the decimal value to the corresponding base 64 character
Concatenate the base 64 characters to form the final integer
Multiple data structures are used to print nodes in a specific order. One data structure cannot be used alone.
The given order suggests a depth-first search traversal of a tree-like structure.
A stack can be used to keep track of the nodes to be visited.
A queue can be used to store the children of a node in the order they are visited.
An array can be used to store the nodes in the required order.
A linked list can be used ...
Find largest pen using minimum comparisons with tops.
Divide pens into two groups and compare largest pen from each group with largest top.
Repeat the process with the group containing the largest pen until only one pen is left.
The remaining pen is the largest pen.
Total number of comparisons required is 2n-3.
Given n dice with 'a' sides and sum b, return no. of ways to obtain b. Optimize time and space complexity.
Use dynamic programming to reduce time complexity
Create a 2D array to store the number of ways to obtain each sum for each number of dice
Use rolling arrays to optimize space complexity
Example: n=2, a=6, b=7 -> 6 ways to obtain sum 7
Example: n=3, a=4, b=8 -> 21 ways to obtain sum 8
Sort 128 GB data on 2 machines with 64 GB RAM each. Extend to 1000 machines.
Use external sorting algorithm like merge sort or quick sort
Divide data into smaller chunks and sort them individually
Merge sorted chunks using additional RAM
For 1000 machines, use distributed sorting algorithms like MapReduce or Hadoop
Ensure data consistency and fault tolerance in distributed sorting
I was interviewed before Jan 2021.
Round duration - 60 Minutes
Round difficulty - Medium
The interviewer asked me 2 questions related to DS/Algo in this round . Both the questions were of Easy-Medium difficulty and I was also required to code them in a production ready manner.
You are provided with a binary tree consisting of N
nodes where each node has an integer value. The task is to determine the maximum sum achievable by a...
Find the maximum sum achievable by a simple path between any two nodes in a binary tree.
Traverse the binary tree to find all possible paths and calculate their sums.
Keep track of the maximum sum encountered during traversal.
Consider paths that may include the same node twice.
Implement a recursive function to explore all possible paths.
Handle cases where nodes have negative values.
Given two arrays A
and B
with sizes N
and M
respectively, both sorted in non-decreasing order, determine their intersection.
The intersection of two arrays in...
The problem involves finding the intersection of two sorted arrays efficiently.
Use two pointers to iterate through both arrays simultaneously.
Compare elements at the pointers and move the pointers accordingly.
Handle cases where elements are equal, and update the intersection array.
Return the intersection array as the result.
Round duration - 50 Minutes
Round difficulty - Medium
This round had 2 questions of DS/Algo to solve under 50 minutes and one question related to Operating Systems.
You are provided with an array or list ARR
containing N
positive integers. Your task is to determine the Next Greater Element (NGE) for each element in the array.
T...
Find the Next Greater Element for each element in an array.
Iterate through the array from right to left
Use a stack to keep track of elements with no greater element to the right
Pop elements from the stack until finding a greater element or stack is empty
Given three integers X
, C
, and Y
, where X
is the first term of an arithmetic sequence with a common difference of C
, determine if Y
is part of this arithmetic sequ...
Check if a given number is part of an arithmetic sequence with a given first term and common difference.
Calculate the arithmetic sequence using the formula: nth term = X + (n-1) * C
Check if Y is equal to any term in the sequence to determine if it belongs to the sequence
Return 'True' if Y belongs to the sequence, otherwise return 'False'
Processes are instances of programs in execution, while threads are smaller units within a process that can execute independently.
A process is a program in execution, consisting of code, data, and resources.
Threads are smaller units within a process that can execute independently.
Processes have their own memory space, while threads share the same memory space within a process.
Processes are heavyweight, while threads ar...
Round duration - 50 Minutes
Round difficulty - Medium
This round had 2 questions of DSA of Easy-Medium difficulty and at the end I was asked a Puzzle to check my general problem solving ability.
Given an array/list arr
of size n
, determine the maximum product possible by taking any subset of the array/list arr
. Return the result modulo 10^9+7
since the product ...
Find the maximum product of a subset of an array modulo 10^9+7.
Iterate through the array and keep track of the maximum positive product and minimum negative product encountered so far.
Handle cases where the array contains zeros separately.
Return the maximum product modulo 10^9+7.
Given a complete binary tree with 'N' nodes, your task is to determine the 'next' node immediately to the right in level order for each node in the given tree.
...Implement a function to update 'next' pointers in a complete binary tree.
Iterate level by level using a queue
Connect nodes at each level using 'next' pointers
Handle null nodes appropriately
Ensure the tree is a complete binary tree
Round duration - 50 Minutes
Round difficulty - Medium
This round consisted of 2 questions from DSA where I was first asked to explain my approach to the interviewer with proper complexity analysis and then code the problems. The interviewer was quite friendly and also provided me some hints when I was stuck.
Create a stack data structure that supports not only the usual push and pop operations but also getMin(), which retrieves the minimum element, all in O(1) time complexity witho...
Implement a stack with push, pop, top, isEmpty, and getMin operations in O(1) time complexity without using extra space.
Use two stacks - one to store the actual elements and another to store the minimum element at each level.
When pushing an element, check if it is smaller than the current minimum and update the minimum stack accordingly.
When popping an element, also pop from the minimum stack if the popped element is t...
You are given an integer array arr
of size N
. Your task is to split the array into the maximum number of subarrays such that the first and last occurre...
Given an array, split it into maximum subarrays with first and last occurrence of each element in a single subarray.
Iterate through the array and keep track of the first and last occurrence of each element.
Use a hashmap to store the indices of each element.
Split the array whenever the last occurrence of an element is found.
Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.
Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.
To determine if a point is inside a polygon, use the ray casting algorithm.
Create a line from the point to a point outside the polygon
Count the number of times the line intersects with the polygon edges
If the count is odd, the point is inside the polygon; otherwise, it is outside
The four storage classes in C are auto, register, static, and extern.
Auto: default storage class for all local variables
Register: used to define local variables that should be stored in a register instead of RAM
Static: used to define local variables that retain their value between function calls
Extern: used to declare a global variable that is defined in another file
i is stored in global data segment, j is stored in stack, k is stored in heap.
i is a global variable and is stored in the global data segment
j is a local variable and is stored in the stack
k is a pointer variable and is stored in the stack, while the memory it points to is allocated on the heap using malloc()
Use a hash table to store the words and check for existence in constant time.
Create a hash table with the words as keys and a boolean value as the value.
For each new word, check if it exists in the hash table. If it does, it has appeared before. If not, add it to the hash table.
Alternatively, use a set data structure to store only the unique words and check for existence in the set.
Operating on images in parallel involves dividing the image into smaller parts and processing them simultaneously.
Divide the image into smaller parts using techniques like tiling or splitting
Use parallel processing techniques like multi-threading or GPU acceleration
Combine the processed parts to form the final image
Examples: image segmentation, object detection, image enhancement
Hardware engines support parallelism through multiple cores and threads.
Hardware engines can have multiple cores and threads to execute tasks simultaneously.
Parallelism can improve performance and efficiency in hardware-based tasks.
Examples include GPUs, FPGAs, and ASICs that have parallel processing capabilities.
Hardware parallelism can also be achieved through distributed computing and clustering.
Programming language...
Modern OSes support parallelism through multi-core processors and threading.
Modern OSes like Windows, macOS, and Linux support parallelism through multi-core processors and threading.
Parallelism can be achieved through processes or threads.
Parallelism can improve performance and efficiency of software.
Examples of parallel programming frameworks include OpenMP and MPI.
Memory protection is a feature of an operating system that prevents unauthorized access to memory locations.
Memory protection is achieved through the use of memory management units (MMUs) and virtual memory.
MMUs map virtual addresses to physical addresses and enforce access permissions.
Virtual memory allows the OS to allocate memory to processes in a way that isolates them from each other.
Examples of memory protection ...
To speed up multiplication of small integers in an array, we can use bitwise operations and parallel processing.
Use bitwise operations like shifting and ANDing to perform multiplication faster.
Divide the array into smaller chunks and perform multiplication in parallel using multi-threading or SIMD instructions.
Use lookup tables for frequently used values to avoid repeated calculations.
Use compiler optimizations like lo...
Design a data structure for excel spreadsheet
Use a 2D array to store cell values
Implement formulas using a stack
Include formatting options for cells
Insertion sort and quicksort are sorting algorithms used to sort arrays of data.
Insertion sort: iterates through the array and inserts each element into its proper position.
Quicksort: selects a pivot element and partitions the array into two sub-arrays, one with elements less than the pivot and one with elements greater than the pivot.
Insertion sort is best for small arrays, while quicksort is best for large arrays.
Bot...
Merge two sorted linked lists using recursion
Create a recursive function that compares the first nodes of both lists
Set the smaller node as the head of the merged list and call the function again with the next node of the smaller list
Base case: if one list is empty, return the other list
Return the merged list
Given an integer, determine which byte is zero.
Convert the integer to a byte array using bitwise operations.
Iterate through the byte array and check for a zero value.
Return the index of the zero byte.
Consider endianness when converting to byte array.
To check endianness, create a 4-byte integer with a known value and check the byte order.
Create a 4-byte integer with a known value
Check the value of the first byte to determine endianness
If the first byte is the least significant, the machine is little endian
If the first byte is the most significant, the machine is big endian
Static objects can be used to print something before main() execution.
Static objects are initialized before main() execution
They can be used to print something before main()
Example: static int x = printf("Hello World!");
Output: Hello World! will be printed before main() execution
Static variables are allocated memory in the data segment of the program's memory space.
Static variables have a fixed memory location throughout the program's execution.
They are initialized to zero by default.
If initialized explicitly, they are stored in the data segment.
Static variables can be accessed by any function in the program.
Finding space and time complexity of a recursive function.
Space complexity is the amount of memory used by the function.
Time complexity is the amount of time taken by the function to execute.
Recursive functions have higher space complexity due to the call stack.
Time complexity can be calculated using Big O notation.
Examples of recursive functions include factorial and Fibonacci sequence.
Diamond hierarchy problem is a problem in object-oriented programming where a class inherits from multiple classes in a diamond-shaped hierarchy.
Occurs when a class inherits from two classes that share a common base class
Can lead to ambiguity in method calls and data members
Solved using virtual inheritance or by using interfaces
based on 1 interview
Interview experience
based on 8 reviews
Rating in categories
Trust and Safety Specialist
73
salaries
| ₹0 L/yr - ₹0 L/yr |
Software Engineer
65
salaries
| ₹0 L/yr - ₹0 L/yr |
Senior Software Engineer
58
salaries
| ₹0 L/yr - ₹0 L/yr |
Content Reviewer
37
salaries
| ₹0 L/yr - ₹0 L/yr |
Account Director
31
salaries
| ₹0 L/yr - ₹0 L/yr |
Microsoft Corporation
Amazon