NCR Voyix
CriticalRiver Interview Questions and Answers
Q1. Longest Palindromic Substring Problem Statement
You are provided with a string STR
of length N
. The goal is to identify the longest palindromic substring within this string. In cases where multiple palindromic ...read more
Given a string, find the longest palindromic substring, prioritizing the one with the smallest start index.
Iterate through the string and expand around each character to find palindromes
Keep track of the longest palindrome found and its starting index
Return the longest palindromic substring with the smallest start index
Q2. Partition Array Minimizing Subset Sum Difference
Given an array containing N non-negative integers, your task is to partition this array into two subsets such that the absolute difference between their sums is ...read more
The task is to partition an array into two subsets such that the absolute difference between subset sums is minimum.
Iterate through all possible subsets of the array
Calculate the sum of each subset
Find the minimum absolute difference between the subset sums
Q3. Reverse a Doubly Linked List
Given a doubly linked list of positive integers with size 'N', reverse the list and return the head of the modified list.
Explanation:
A doubly linked list allows traversal in both ...read more
The task is to reverse a given doubly linked list and return the head of the modified list.
Create three pointers: prev, current, and next.
Iterate through the linked list and update the next and prev pointers for each node.
Finally, update the head pointer to the last node visited and return it as the head of the reversed list.
Q4. Prime Time Again Problem Statement
You are given two integers DAY_HOURS
and PARTS
. Consider a day with DAY_HOURS
hours, which can be divided into PARTS
equal parts. Your task is to determine the total instances...read more
Count the total instances of equivalent prime groups in a day divided into equal parts.
Divide the day into equal parts and check for prime groups at the same position in different parts.
Each prime group should consist of prime numbers occurring at different parts of the day.
Return the total number of equivalent prime groups found.
Example: For DAY_HOURS = 20 and PARTS = 2, there are 2 prime groups: 3-13 and 7-17.
Q5. Find the Third Greatest Element
Given an array 'ARR' of 'N' distinct integers, determine the third largest element in the array.
Input:
The first line contains a single integer 'T' representing the number of te...read more
Find the third largest element in an array of distinct integers.
Sort the array in descending order and return the element at index 2.
Handle cases where there are less than 3 elements in the array.
Consider edge cases like negative integers and duplicates.
Q6. Sort Elements by Frequency
Your task is to sort a list of repeated integers by their frequency in decreasing order. The element with the highest frequency should appear first. If two elements have the same freq...read more
The task is to sort a list of integers based on their frequency of repetition, with the element with the highest frequency first.
Count the frequency of each element in the list using a dictionary.
Sort the elements based on their frequency in descending order.
If two elements have the same frequency, maintain their original order.
Return the sorted list.
Q7. Count Distinct Ways to Reach the Nth Stairs
Consider a scenario where you have been given a number of stairs. You start at the 0th stair and need to reach the Nth stair. With each stride, you can choose to eith...read more
The task is to find the number of distinct ways to move from the 0th to the Nth stair by ascending one or two steps at a time.
Use dynamic programming to solve this problem efficiently.
The number of ways to reach the Nth stair is the sum of the number of ways to reach the (N-1)th stair and the number of ways to reach the (N-2)th stair.
Handle base cases for N=0 and N=1 separately.
Consider using memoization to avoid redundant calculations.
Example: For N=3, the number of distinct...read more
I have worked on projects involving web development, machine learning, and mobile app development using technologies such as React, Python, and Flutter.
Web development project using React and Node.js for frontend and backend
Machine learning project using Python and TensorFlow for model training and deployment
Mobile app development project using Flutter for cross-platform app development
Top Software Developer Intern Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month