i
FieldAssist
Filter interviews by
Clear (1)
Find the second largest element in an array of strings
Sort the array in descending order
Return the element at index 1
Top trending discussions
I was interviewed before Sep 2020.
Round duration - 90 minutes
Round difficulty - Easy
This was MCQ+Coding round.
Check if two strings are anagrams by comparing the sorted versions of the strings.
Sort both strings and compare if they are equal.
Use a hashmap to store the frequency of characters in each string and compare the maps.
Ignore spaces and punctuation when comparing the strings.
Round duration - 90 minutes
Round difficulty - Easy
This was face to face interview round.
Round duration - 90 minutes
Round difficulty - Easy
This was face to face interview round.
Tip 1 : Participate in live contests on websites like Codechef, Codeforces etc as much as possible.
Tip 2 : Practice previous interview questions from LeetCode, GeeksForGeeks.
Tip 3 : Revise Computer Science subjects like DBMS, OOPS thoroughly.
Add projects and Internships if you have done any and add only those things which you really know.
Final outcome of the interviewSelectedI was interviewed before Sep 2020.
Round duration - 90 Minutes
Round difficulty - Medium
Interview started at 11:00 am. It was an online round. During the coding round I submitted optimized solution and got full acceptance of the solutions.
You are provided with a directed graph composed of 'N' nodes. You have a matrix called 'EDGES' with dimensions M x 2, which specifies the 'M' edges in the graph. Each edge...
Detect cycle in a directed graph using depth-first search (DFS) algorithm.
Use DFS to traverse the graph and detect back edges indicating a cycle.
Maintain a visited array to keep track of visited nodes during traversal.
If a node is visited again during traversal and it is not the parent node, then a cycle exists.
Return true if a cycle is detected, false otherwise.
Round duration - 80 Minutes
Round difficulty - Medium
Interview started at 10:00 am. Interview went well, I was able to connect with the interviewer and enjoyed the whole interview
Find the next smallest palindrome strictly greater than a given number 'N' represented as a string 'S'.
You are given a number in string format, a...
Find the next smallest palindrome greater than a given number represented as a string.
Convert the string to an integer, find the next greater palindrome, and convert it back to a string.
Handle cases where the number is a palindrome or has all digits as '9'.
Consider both odd and even length numbers when finding the next palindrome.
Round duration - 80 Minutes
Round difficulty - Medium
Interview started at 11:00 am. Interview went well.
Given a binary tree of integers, your task is to return the boundary nodes of the tree in Anti-Clockwise direction starting from the root node.
The first line ...
Return the boundary nodes of a binary tree in Anti-Clockwise direction starting from the root node.
Traverse the left boundary nodes in a top-down manner
Traverse the leaf nodes from left to right
Traverse the right boundary nodes in a bottom-up manner
Handle cases where duplicates occur in the boundary nodes
Implement the function without printing as printing is already managed
Tip 1 : For Data Structures number of questions doesn't matter. Try to understand the logic behind them and try to apply them in creating multiple scenario's. Learn them by heart.
Tip 2 : For Web.Development Try to learn full stack development. See which part interests you more, Increase your knowledge horizon, Always try to build a system a system considering It will be served to millions of customers. By doing this 1-2 projects will increase and cover all the major things which one should learn in their career/college.
Tip 1 : Always try to make it a single page
Tip 2 : Always make resume company specific. eg. Data Structures part more if you are applying for MNC's eg. Amazon, Google, DE Shaw, browserstack.
I was interviewed 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)
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
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.
Return all root to leaf node paths in 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 array.
Include row, col and value of each node in the path.
Use an array of strings to store the paths.
To get max value from a stack in O(1), maintain a separate stack to keep track of maximum values.
Create a separate stack to keep track of maximum values
Push the maximum value onto the stack whenever a new maximum is encountered
Pop the maximum value stack whenever the top element of the main stack is popped
Return the top element of the maximum value stack to get the maximum value in O(1)
To get max element from a queue in O(1) time complexity
Maintain a separate variable to keep track of the maximum element in the queue
Update the maximum element variable whenever a new element is added or removed from the queue
Return the maximum element variable when getMax() function is called
Find the Next Greatest Element to the right for each element in an array of strings.
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
Return the result array
To remove unnecessary parenthesis from an expression, we need to apply a set of rules to identify and eliminate them.
Identify and remove parenthesis around single variables or constants
Identify and remove parenthesis around expressions with only one operator
Identify and remove parenthesis around expressions with operators of equal precedence
Identify and remove parenthesis around expressions with operators of different ...
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 of the two products.
Find length of longest consecutive sub array forming an AP from given array of integers.
Sort the array in ascending order
Iterate through the array and find the longest consecutive sub array forming an AP
Use a variable to keep track of the length of the current consecutive sub array forming an AP
Use another variable to keep track of the length of the longest consecutive sub array forming an AP seen so far
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.
I was interviewed before May 2021.
Round duration - 90 minutes
Round difficulty - Medium
Around 65-70 people sat for the test. 15 people were shortlisted. It consisted of the following to be done in 90 minutes.
- 28 MCQs based on core CS
- 2 Coding questions – everyone had different and random questions. Most questions were custom logic based (easy level) including some standard questions – LCS, LIS, topological sort.
Round duration - 60 minutes
Round difficulty - Easy
Interviewer was very friendly. It started with the standard – tell me about yourself / introduce yourself type of question. Then he proceeded and asked two coding questions
Your friend has homework to complete. Help him by removing duplicates from a sorted linked list.
You are given the 'Head' of a sorted linked list. Modify the l...
Remove duplicates from a sorted linked list without adjacent duplicates.
Traverse the linked list while comparing current and next nodes.
If they are equal, skip the next node by updating the current node's next pointer.
Repeat until the end of the list is reached.
You are enrolled as a student and must complete N
courses, numbered from 1 to N, to earn your degree.
Some courses have prerequisites, which means that to take course i
,...
Check if it is feasible to complete all courses with prerequisites.
Create a graph representing the prerequisites with courses as nodes and edges as prerequisites.
Perform a topological sort on the graph to check if there is a cycle (if there is, then it's not feasible to complete all courses).
If there is no cycle, then it is feasible to complete all courses.
Round duration - 60 minutes
Round difficulty - Medium
This round had only 1 question. The interviewer introduced himself. And he advised me to clearly understand the problem before proceeding.
You are given a binary tree of distinct integers, along with two nodes, ‘X’ and ‘Y’. Your task is to determine the Lowest Common Ancestor (LCA) of ‘X’ and ‘Y’.
The LC...
Find the Lowest Common Ancestor of two nodes in a binary tree.
Traverse the binary tree to find the paths from the root to nodes X and Y.
Compare the paths to find the last common node, which is the Lowest Common Ancestor.
Implement a recursive function to efficiently find the LCA.
Handle cases where one node is an ancestor of the other.
Consider edge cases like when X or Y is the root node.
Round duration - 60 minutes
Round difficulty - Medium
Pretty Good Round. Fast Paced. We covered a lot of ground.
Design and implement a class BSTIterator
to perform an in-order traversal over a Binary Search Tree (BST). Your implementation should include the following me...
Design and implement a class BSTIterator to perform in-order traversal over a Binary Search Tree (BST).
Implement a parameterized constructor to initialize the iterator with the root of the BST.
Implement a method 'next()' to return the next smallest element in in-order traversal.
Implement a method 'hasNext()' to check if there exists a next smallest element in traversal.
Ensure the output is the in-order traversal of the
Given a binary array 'ARR' of size 'N', your task is to determine the maximum length of a sequence consisting solely of 1’s that can be obtained by converting at...
Find the maximum length of a sequence of 1's by converting at most K zeroes into ones in a binary array.
Iterate through the array and keep track of the current window of 1's and zeroes.
Use a sliding window approach to find the maximum length of consecutive 1's by flipping at most K zeroes.
Update the window based on the number of zeroes flipped and keep track of the maximum length found so far.
Return the maximum length ...
You are given an undirected and disconnected graph G(V, E)
having V
vertices numbered from 0
to V-1
and E
edges. Your task is to print its BFS traversal starting from the 0t...
BFS traversal of an undirected and disconnected graph starting from vertex 0.
Start BFS traversal from vertex 0 and visit all connected nodes in sorted order.
Use a queue to keep track of nodes to visit next.
Keep a visited array to avoid revisiting nodes.
Print the BFS traversal path as the nodes are visited.
Example: For input V=5, E=4 and edges 0-1, 0-2, 1-3, 2-4, the BFS traversal will be [0, 1, 2, 3, 4].
Given an undirected graph with V
vertices (labeled 0, 1, ..., V-1) and E
edges, each edge connects two nodes X
and Y
with a specified weight representing the dis...
Dijkstra's algorithm is used to find the shortest path distance from a source node to all other nodes in an undirected graph.
Implement Dijkstra's algorithm to find the shortest path distance from node 0 to all other nodes in the graph.
Use a priority queue to efficiently select the next node with the shortest distance.
Initialize distances to all nodes as infinity, except for the source node which is 0.
Update distances t...
Round duration - 60 minutes
Round difficulty - Hard
Bar Raised Round. Definitely felt the difficulty.
You are given a string consisting of English alphabet characters. Your task is to identify and return the first character in the string that does not repeat...
Identify and return the first non-repeating character in a string, or the first character if all characters repeat.
Iterate through the string to count the frequency of each character
Iterate through the string again to find the first character with frequency 1
If no such character is found, return the first character of the string
Tip 1 : Practice at least 250 Questions, Give yourself enough time for preparation. Cramming won't take you very far. In books, I really liked Elements of Programming Interviews.
Tip 2 : Make sure to brush up your basics - coding style, OOPs, Language features. They help in making an impression.
Tip 3 : Don't worry about solving the question in the interview. Learn to tackle any random problem with the best of your ability. More often than not, that'd be enough.
Tip 1 : Keep your resume clean - no graphics, no multiple fonts. Keep it one page.
Tip 2 : Don't go over board in mentioning skills, only mention the things you are truly confident about.
I was interviewed before Sep 2020.
Round duration - 60 minutes
Round difficulty - Easy
Round duration - 50 minutes
Round difficulty - Easy
Round duration - 60 minutes
Round difficulty - Easy
At the beginning of this round, the interviewer asked me about the data structures I knew. Linked lists, trees, graphs, arrays etc. was my answer. He asked me how well I knew Dynamic Programming. I said I wasn’t strong in that and he said that he would ask me a question on dynamic programming for sure.
Round duration - 40 minutes
Round difficulty - Easy
The interviewer asked me if I was comfortable with the interview process so far and how the previous interviews were. I said it was good and he gave me the first problem to solve.
Round duration - 60 minutes
Round difficulty - Easy
The interviewer asked me some Computer Science fundamentals in this round as well as some behavioural questions.
Implement a Trie data structure with insert and search functions.
Create a TrieNode class with children and isEndOfWord attributes.
Implement insert function to add words by iterating through characters.
Implement search function to check if a word exists by traversing the Trie.
Example: Insert 'apple', 'banana', 'orange' and search for 'apple' and 'grape'.
Do lot of hard work and practice of Data Structures and Algorithms based questions. I personally recommend you Coding Ninjas and Geeks For Geeks for interview preparation.
Application resume tips for other job seekersMake your resume short and try to make it of one page only and do mention all your skills which you are confident of in your resume.
Final outcome of the interviewSelectedbased on 3 interviews
Interview experience
Customer Success Manager
39
salaries
| ₹0 L/yr - ₹0 L/yr |
Associate Product Manager
16
salaries
| ₹0 L/yr - ₹0 L/yr |
Project Manager
12
salaries
| ₹0 L/yr - ₹0 L/yr |
Senior Customer Success Manager
12
salaries
| ₹0 L/yr - ₹0 L/yr |
Software Developer
11
salaries
| ₹0 L/yr - ₹0 L/yr |
Salesforce
Zoho
Freshworks
Oracle