Ola Cabs
Remondis Aqua Interview Questions and Answers
Q1. Job Sequencing Problem Statement
You are provided with a N x 2 2-D array called Jobs
consisting of N
jobs. In this array, Jobs[i][0]
represents the deadline of the i-th job, while Jobs[i][1]
indicates the profi...read more
Maximize profit by scheduling jobs within their deadlines.
Sort the jobs based on their profits in descending order.
Iterate through the sorted jobs and schedule them based on their deadlines.
Keep track of the maximum profit achievable by scheduling jobs within their deadlines.
Q2. Print Permutations - String Problem Statement
Given an input string 'S', you are tasked with finding and returning all possible permutations of the input string.
Input:
The first and only line of input contains...read more
Return all possible permutations of a given input string.
Use recursion to generate all possible permutations of the input string.
Swap characters at different positions to generate permutations.
Handle duplicate characters by skipping swapping if the characters are the same.
Q3. Partition Equal Subset Sum Problem
Given an array ARR
consisting of 'N' positive integers, determine if it is possible to partition the array into two subsets such that the sum of the elements in both subsets i...read more
The problem is to determine if it is possible to partition an array into two subsets with equal sum.
Use dynamic programming to solve this problem efficiently.
Create a 2D array to store the subset sum possibilities.
Check if the total sum of the array is even before attempting to partition.
Iterate through the array and update the subset sum array accordingly.
Return true if the subset sum array contains a sum equal to half of the total sum.
Q4. Find Distinct Palindromic Substrings
Given a string 'S', identify and print all distinct palindromic substrings within it. A palindrome reads the same forwards and backwards. For example, 'bccb' is a palindrome...read more
Given a string, find and print all distinct palindromic substrings within it.
Iterate through all possible substrings of the input string
Check if each substring is a palindrome
Store distinct palindromic substrings in a set and then sort them before printing
Q5. Find the Kth Row of Pascal's Triangle Problem Statement
Given a non-negative integer 'K', determine the Kth row of Pascal’s Triangle.
Example:
Input:
K = 2
Output:
1 1
Input:
K = 4
Output:
1 4 6 4 1
Constraints...read more
The task is to find the Kth row of Pascal's Triangle given a non-negative integer K.
Create an array to store the elements of the Kth row of Pascal's Triangle.
Use the formula C(n, k) = C(n-1, k-1) + C(n-1, k) to calculate the elements.
Return the array as the output.
Different types of joins in SQL and calculating average of values from a table.
Types of joins: INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL JOIN
To calculate average: Use AVG() function in SQL
Example: SELECT AVG(column_name) FROM table_name
Q7. Find the sum of the least closest element to the left and the highest element to the right for each element of a array
Find sum of least closest element to left and highest element to right for each element of an array
Iterate through array and find least closest element to left and highest element to right for each element
Calculate sum of these two elements for each element
Return array of sums
Top SDE-2 Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month