Yubi
Interview Questions and Answers
Q1. Minimum energy required to cross all the hurdles without loosing life. If any point energy becomes 0 game over. Input: [-2,-3,3,1,5]
Find minimum energy required to cross all hurdles without losing life.
Calculate cumulative sum of energy required to cross each hurdle.
Find the minimum cumulative sum and add 1 to it.
If the minimum cumulative sum is negative, return its absolute value + 1.
This is the minimum energy required to cross all hurdles without losing life.
Q2. Find edge score of the nodes in a directed graph
Edge score of nodes in a directed graph
Edge score is a measure of the importance of a node in a graph
It is calculated by counting the number of edges that point to or from a node
Nodes with higher edge scores are considered more important
Edge score can be calculated using algorithms like PageRank or HITS
Q3. Minimum number of platforms required for train station
Minimum of two platforms are required for a train station.
At least two platforms are needed for trains to arrive and depart simultaneously.
Additional platforms may be required depending on the frequency of trains and passenger traffic.
Platforms should be long enough to accommodate the longest trains that will use the station.
Q4. Rotten oranges after every second in 2D matrix
Simulate rotting of oranges in a 2D matrix every second.
Create a queue to store the coordinates of fresh oranges
Iterate through the matrix and add the coordinates of fresh oranges to the queue
Simulate the rotting process by iterating through the queue and rotting adjacent fresh oranges
Keep track of the time taken for all oranges to rot
Return -1 if there are any fresh oranges left after the simulation
Q5. DB design for air ticket booking system
DB design for air ticket booking system
Create tables for flights, passengers, bookings, and payments
Use foreign keys to establish relationships between tables
Include fields for flight details, passenger information, and payment details
Consider implementing a caching mechanism for frequently accessed data
Q6. sort the elements of an unsorted array
Use any sorting algorithm to sort the elements of an unsorted array.
Choose an appropriate sorting algorithm based on the size of the array and the type of elements.
Common sorting algorithms include bubble sort, insertion sort, selection sort, merge sort, quick sort, and heap sort.
Implement the chosen algorithm in the programming language of your choice.
Test the sorting function with various input arrays to ensure correctness.
Q7. Longest Palindromic substring
The problem is to find the longest substring that is a palindrome in a given string.
A palindrome is a string that reads the same backward as forward.
We can use dynamic programming to solve this problem.
We can start by considering each character as the center of a palindrome and expand outwards to find the longest palindrome.
We can also optimize the solution by using Manacher's algorithm which reduces the time complexity to O(n).
Top Senior Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month