Nagarro
400+ Pioneer Valves & Flow Control Interview Questions and Answers
Q1. Crazy Numbers Pattern Challenge
Ninja enjoys arranging numbers in a sequence. He plans to arrange them in 'N' rows such that:
- The first row contains 1 number.
- The second row contains 2 numbers.
- The third row c...read more
Q2. String Compression Problem Statement
Ninja needs to perform basic string compression. For any character that repeats consecutively more than once, replace the repeated sequence with the character followed by th...read more
Q3. Ninja and the New Year Guests Problem
Ninja has organized a new year party and wants to verify if the guests are programmers by challenging them with a coding task. As an invited programmer, you're tasked to so...read more
Q4. Write a program: two input, one is N(any integer, lets say 3), second input will be array of integers(duplicate/multiple occurrences of same integer, lets say [2,3,2,4,2] ). You have to return the number whose...
read moreProgram to find the number whose occurrence is greater than N/2 in an array of integers.
Take two inputs, one integer N and an array of integers.
Loop through the array and count the occurrence of each number.
Return the number whose occurrence is greater than N/2.
If no such number found, return '-1'.
Q5. Swap Kth Elements in an Array
Given an array ARR
of size N
, perform the operation to swap the Kth element from the beginning with the Kth element from the end of the array.
Example:
Input:
N = 5, K = 2
ARR = [1,...read more
Q6. Maximum Subarray Sum Problem Statement
Given an array arr
of length N
consisting of integers, find the sum of the subarray (including empty subarray) with the maximum sum among all subarrays.
Explanation:
A sub...read more
Q7. Maximum Meetings Problem Statement
Given the schedule of N meetings with their start time Start[i]
and end time End[i]
, you need to determine which meetings can be organized in a single meeting room such that t...read more
Q8. Fibonacci Membership Check
Given an integer N
, determine if it is a member of the Fibonacci series. Return true
if the number is a member of the Fibonacci series, otherwise return false
.
Fibonacci Series Defini...read more
Q9. Ways To Make Coin Change
Given an infinite supply of coins of varying denominations, determine the total number of ways to make change for a specified value using these coins. If it's not possible to make the c...read more
Q10. Longest Increasing Subsequence Problem Statement
Given an array of integers with 'N' elements, determine the length of the longest subsequence where each element is greater than the previous element. This subse...read more
Q11. Coin Game Winner Problem Statement
Two players 'X' and 'Y' are participating in a coin game. Starting with 'N' coins, players alternate turns, with 'X' starting first. On each turn, a player has three choices: ...read more
Q12. Next Permutation Problem Statement
You are given a permutation of 'N' integers. A sequence of 'N' integers is considered a permutation if it includes all integers from 1 to 'N' exactly once. Your task is to rea...read more
Q13. Problem: Sort an Array of 0s, 1s, and 2s
Given an array/list ARR
consisting of integers where each element is either 0, 1, or 2, your task is to sort this array in increasing order.
Input:
The input starts with...read more
Q14. Count Pairs with Difference K
Given an array of integers and an integer K
, determine and print the count of all pairs in the array that have an absolute difference of K
.
Input:
The first line of the input conta...read more
Q15. Find Duplicates in an Array
Given an array ARR
of size 'N', where each integer is in the range from 0 to N - 1, identify all elements that appear more than once.
Return the duplicate elements in any order. If n...read more
Q16. Count Ways To Reach The N-th Stair Problem Statement
You are given a number of stairs, N
. Starting at the 0th stair, you need to reach the Nth stair. Each time you can either climb one step or two steps. You ha...read more
Q17. Trapping Rain Water Problem Statement
You are given a long type array/list ARR
of size N
, representing an elevation map. The value ARR[i]
denotes the elevation of the ith
bar. Your task is to determine the tota...read more
Q18. Digits Decoding Problem Statement
A few days back, Ninja encountered a string containing characters from ‘A’ to ‘Z’ which indicated a secret message. For security purposes, he encoded each character of the stri...read more
Q19. Closest Perfect Square Problem Statement
Given a positive integer 'N', determine the perfect square number closest to 'N' and the number of steps required to reach that perfect square.
Example:
Input:
N = 21
Ou...read more
Q20. Find the Longest Palindromic Substring
Given a string ‘S’ composed of lowercase English letters, your task is to identify the longest palindromic substring within ‘S’.
If there are multiple longest palindromic ...read more
Q21. Nth Prime Number Problem Statement
Find the Nth prime number given a number N.
Explanation:
A prime number is greater than 1 and is not the product of two smaller natural numbers. A prime number has exactly two...read more
Q22. Missing Number Statement
Given an array ARR
of integers with size N
, where all elements appear an even number of times except for one element which appears an odd number of times, identify the element that appe...read more
Q23. Nearest Numbers with the Same Number of Set Bits
Given a positive integer n
, your task is to determine the next smallest integer and the previous largest integer that have the same number of '1' bits in their b...read more
Q24. Complete String Problem Statement
Given an array of strings A
of size N
, determine the longest complete string. A string is deemed complete if every prefix of the string also appears in the array. If multiple s...read more
Q25. Palindrome String Validation
Determine if a given string 'S' is a palindrome, considering only alphanumeric characters and ignoring spaces and symbols.
Note:
The string 'S' should be evaluated in a case-insensi...read more
Q26. Equilibrium Index Problem Statement
Given an array Arr
consisting of N integers, your task is to find the equilibrium index of the array.
An index is considered as an equilibrium index if the sum of elements of...read more
Q27. Valid Parentheses Problem Statement
Given a string 'STR' consisting solely of the characters “{”, “}”, “(”, “)”, “[” and “]”, determine if the parentheses are balanced.
Input:
The first line contains an integer...read more
Q28. Secret Message Decoding Problem
Ninja encountered an encoded secret message where each character from 'A' to 'Z' is mapped to a numeric value (A = 1, B = 2, ..., Z = 26). Given a numeric sequence (SEQ) derived ...read more
Q29. 0/1 Knapsack Problem Statement
A thief is planning to rob a store and can carry a maximum weight 'W' in their knapsack. The store contains 'N' items, each with a known weight and value. Given these constraints,...read more
Q30. K - Sum Path In A Binary Tree
Given a binary tree where each node contains an integer value, and a value 'K', your task is to find all the paths in the binary tree such that the sum of the node values in each p...read more
Q31. Convert Sentence Problem Statement
Convert a given string 'S' into its equivalent representation based on a mobile numeric keypad sequence. Using the keypad layout shown in the reference, output the sequence of...read more
Q32. Prime Numbers Identification
Given a positive integer N
, your task is to identify all prime numbers less than or equal to N
.
Explanation:
A prime number is a natural number greater than 1 that has no positive d...read more
Q33. Subsequences of String Problem Statement
You are provided with a string 'STR'
that consists of lowercase English letters ranging from 'a' to 'z'. Your task is to determine all non-empty possible subsequences of...read more
Q34. K Subsets with Equal Sum Problem Statement
Determine whether it is possible to partition an array ARR
into K
subsets, each having an equal sum.
Example:
Input:
ARR = [3, 5, 2, 4, 4], K = 2
Output:
true
Explanat...read more
Q35. Count Derangements
Determine the number of derangements possible for a set of 'N' elements. A derangement is a permutation where no element appears in its original position.
Input:
An integer 'T' representing t...read more
Q36. Rearrange Array: Move Negative Numbers to the Beginning
Given an array ARR
consisting of N
integers, rearrange the elements such that all negative numbers are located before all positive numbers. The order of e...read more
Q37. Common Elements Problem Statement
Identify and output the common strings present in both given arrays of lowercase alphabets for each test case.
Input:
The first line contains an integer 'T' representing the nu...read more
Q38. Character Counting Challenge
Create a program that counts and prints the total number of specific character types from user input. Specifically, you need to count lowercase English alphabets, numeric digits (0-...read more
Q39. N-th Term Of Geometric Progression
Find the N-th term of a Geometric Progression (GP) series given the first term A, the common ratio R, and the term position N.
Explanation:
The general form of a GP series is ...read more
Q40. K Sum Subset Problem Statement
Given an array arr
of size 'N' and an integer 'K', determine the maximum subset sum of the array that does not exceed 'K'.
Example:
Input:
arr = [1, 3, 5, 9], K = 16
Output:
15
Ex...read more
Q41. Trailing Zeros in Factorial Problem
Find the number of trailing zeroes in the factorial of a given number N
.
Input:
The first line contains an integer T
representing the number of test cases.
Each of the followi...read more
Q42. Minimum Number of Platforms Needed Problem Statement
You are given the arrival and departure times of N trains at a railway station for a particular day. Your task is to determine the minimum number of platform...read more
Q43. Letter Combinations of a Phone Number Problem Statement
You are given a string S
containing digits from 2 to 9 inclusive. Your task is to find all possible letter combinations that the number could represent, b...read more
Q44. Pair Sum Problem Statement
You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to find and return a list of all pairs of elements where each sum of a pair equals 'S'.
Note:
Each pa...read more
Q45. Find All Pairs Adding Up to Target
Given an array of integers ARR
of length N
and an integer Target
, your task is to return all pairs of elements such that they add up to the Target
.
Input:
The first line conta...read more
Q46. Find the Second Largest Element
Given an array or list of integers 'ARR', identify the second largest element in 'ARR'.
If a second largest element does not exist, return -1.
Example:
Input:
ARR = [2, 4, 5, 6, ...read more
Q47. Validate BST Problem Statement
Given a binary tree with N
nodes, determine whether the tree is a Binary Search Tree (BST). If it is a BST, return true
; otherwise, return false
.
A binary search tree (BST) is a b...read more
Q48. Sort a "K" Sorted Doubly Linked List Problem Statement
You are given a doubly linked list with 'N' nodes, where each node can deviate at most 'K' positions from its actual position in the sorted list. Your task...read more
Q49. First Non-Repeating Character Problem Statement
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. If e...read more
Q50. Partition to K Equal Sum Subsets Problem
Given an array of integers and a positive integer 'K', determine if it is possible to divide the array into 'K' non-empty subsets such that the sum of elements in each s...read more
Q51. Sort a "K" Sorted Doubly Linked List
Given a doubly-linked list with N
nodes, where each node’s position deviates at most K
positions from its position in the sorted list, your task is to sort this given doubly...read more
Q52. Counting Derangements Problem
A derangement is a permutation of 'N' elements, where no element appears in its original position. For instance, a derangement of {0, 1, 2, 3} is {2, 3, 1, 0} because each element ...read more
Q53. Reverse Alternate K Nodes Problem Statement
You are given a singly linked list of integers along with a positive integer 'K'. The task is to modify the linked list by reversing every alternate 'K' nodes of the ...read more
Q54. This is for Mainframe Dev. how would you sort two unsorted ps files into three different ps files having unique records of both the files in different files and common records in one. explain the steps.
Sort two unsorted PS files into three different PS files with unique and common records.
Use SORT utility to sort the two input files individually.
Use JOINKEYS to join the two sorted files on a common key.
Use OUTFIL to direct the output to three different files based on the record type.
Ensure that the output files have unique records and common records as required.
Q55. Convert First Letter to Upper Case
Given a string STR
, transform the first letter of each word in the string to uppercase.
Example:
Input:
STR = "I am a student of the third year"
Output:
"I Am A Student Of The...read more
Q56. Print All Paths Problem Statement
In this problem, you are provided with a graph consisting of 'N' nodes and 'M' unidirectional edges. Additionally, two integers 'S' and 'D' are given, representing the source a...read more
Q57. Maximum Path Sum Between Two Leaves
Given a non-empty binary tree where each node has a non-negative integer value, determine the maximum possible sum of the path between any two leaves of the given tree.
Expla...read more
Q58. Stock Trading Maximum Profit Problem
Given the stock prices for 'N' days, your goal is to determine the maximum profit that can be achieved. You can buy and sell the stocks any number of times but can only hold...read more
Q59. Word Break Problem Statement
You are given a list of N
strings called A
. Your task is to determine whether you can form a given target string by combining one or more strings from A
.
The strings from A
can be u...read more
Q60. Rotational Equivalence of Strings Problem Statement
Given two strings 'P' and 'Q' of equal length, determine if string 'P' can be transformed into string 'Q' by cyclically rotating it to the right any number of...read more
Q61. Merge k Sorted Linked Lists
You are provided with 'K' sorted linked lists, each sorted in increasing order. Your task is to merge all these lists into one single sorted linked list and return the head of the re...read more
Q62. Number of Islands Problem Statement
You are provided with a 2-dimensional matrix having N
rows and M
columns, containing only 1s (land) and 0s (water). Your goal is to determine the number of islands in this ma...read more
Q63. Zigzag Binary Tree Traversal Problem
Given a binary tree, compute the zigzag level order traversal of the node values in the tree. The zigzag traversal requires traversing levels from left to right, then right ...read more
Q64. Maximum Meetings Selection
You are tasked with scheduling meetings in a single meeting room. Given N
meetings, each with a start time Start[i]
and end time End[i]
, determine the maximum number of meetings that ...read more
Q65. Remove String from Linked List Problem
You are provided with a singly linked list where each node contains a single character, along with a string 'STR'. Your task is to remove all occurrences of the string 'ST...read more
Q66. Most Frequent Word Problem Statement
You are given two strings 'A' and 'B' composed of words separated by spaces. Your task is to determine the most frequent and lexicographically smallest word in string 'A' th...read more
Q67. Guess The Hidden Number Problem Statement
You are given an integer N
and there is a hidden number within the range [0, N] that you must guess. You have access to a function higherLower(k)
which helps in guessin...read more
Q68. Detect and Remove Loop in Linked List
For a given singly linked list, identify if a loop exists and remove it, adjusting the linked list in place. Return the modified linked list.
Expected Complexity:
Aim for a...read more
Q69. Trapping Rainwater Problem Statement
You are given an array ARR
of long type, which represents an elevation map where ARR[i]
denotes the elevation of the ith
bar. Calculate the total amount of rainwater that ca...read more
Q70. String Rotation Problem Statement
You are given a string named str
and an integer D
. Your task is to perform both left (anticlockwise) and right (clockwise) rotations on the given string by D
units, starting fr...read more
Q71. Merge Sort Linked List Problem Statement
You are given a singly linked list of integers. Your task is to sort the linked list using the merge sort algorithm.
Explanation:
Merge Sort is a divide and conquer algo...read more
Q72. Reverse Linked List Problem Statement
Given a Singly Linked List of integers, your task is to reverse the Linked List by altering the links between the nodes.
Input:
The first line of input is an integer T, rep...read more
Q73. Minimum Steps for a Knight to Reach Target
Given a square chessboard of size N x N
, you need to determine the minimum number of steps a Knight takes to reach a target position from its starting position.
Input:...read more
Q74. Count Palindrome Words in a String
Given a string 'S' consisting of words, your task is to determine the number of palindrome words within 'S'. A word is considered a palindrome if it reads the same backward as...read more
Q75. Preorder Traversal Problem Statement
You are provided with the root node of a binary tree comprising N
nodes. Your objective is to output its preorder traversal. Preorder traversal of a binary tree is performed...read more
Q76. Check If Binary Representation of a Number is Palindrome
Given an integer N
, determine if its binary representation is a palindrome.
Input:
The first line contains a single integer ‘T’ representing the number o...read more
Q77. Duplicate Subtrees Problem Statement
Given a binary tree, return the root values of all duplicate subtrees. Two subtrees are considered duplicate if they have the same structure with identical node values. For ...read more
Q78. Make Unique Array Challenge
Your task is to determine the minimum number of elements that need to be removed from an array 'ARR' of size 'N' such that all the remaining elements are distinct. In simpler terms, ...read more
Q79. Distribute N Candies Among K People
Explanation: Sanyam wishes to distribute 'N' candies among 'K' friends. The friends are arranged based on Sanyam's order of likeness. He initially distributes candies such th...read more
Q80. Median of Two Sorted Arrays
Given two sorted arrays A
and B
of sizes N
and M
, find the median of the merged array formed by combining arrays A
and B
. If the total number of elements, N + M
, is even, the median ...read more
Q81. Sort 0 and 1 Problem Statement
Given an integer array ARR
of size N
containing only integers 0 and 1, implement a function to sort this array. The solution should scan the array only once without using any addi...read more
Q82. Spiral Order Traversal of a Binary Tree
Given a binary tree with N
nodes, your task is to output the Spiral Order traversal of the binary tree.
Input:
The input consists of a single line containing elements of ...read more
Q83. Code Optimization Problem
Ninja encountered an issue with a practice problem where certain test cases could not be passed due to high time complexity. You are provided with a snippet of pseudocode, and your tas...read more
Q84. Binary Palindrome Check
Given an integer N
, determine whether its binary representation is a palindrome.
Input:
The first line contains an integer 'T' representing the number of test cases.
The next 'T' lines e...read more
Q85. Character Formation Check
Determine if the second string STR2
can be constructed using characters from the first string STR1
. Both strings may include any characters.
Input:
The first line contains an integer T...read more
Q86. Count Pairs with Given Sum
Given an integer array/list arr
and an integer 'Sum', determine the total number of unique pairs in the array whose elements sum up to the given 'Sum'.
Input:
The first line contains ...read more
Q87. Jumping Game Problem Statement
In this problem, you have ‘n’ carrots lined up and denoted by numbers 1 through ‘n’. There are ‘k’ rabbits, and each rabbit can jump to carrots that are multiples of its unique ju...read more
Q88. Reverse Stack with Recursion
Reverse a given stack of integers using recursion. You must accomplish this without utilizing extra space beyond the internal stack space used by recursion. Additionally, you must r...read more
Q89. String Transformation Problem
Given a string (STR
) of length N
, you are tasked to create a new string through the following method:
Select the smallest character from the first K
characters of STR
, remove it fr...read more
Q90. Segregate Odd-Even Problem Statement
In a wedding ceremony at NinjaLand, attendees are divided into two groups: bride’s side and groom’s side. Attendees from the bride’s side hold odd numbers, while those from ...read more
Q91. Write a program: single input as a string(lets say "aaabcccfffghh"), you have to return the char and their occurrence as a string. In this case you have to return "a3b1c3f3g1h2"
Program to return character and their occurrence in a string.
Iterate through the string and count the occurrence of each character.
Store the count in a dictionary or hashmap.
Create a new string by concatenating the character and their count.
Return the new string.
Q92. Smallest Window Problem Statement
Given two strings S
and X
containing random characters, the task is to find the smallest substring in S
which contains all the characters present in X
.
Input:
The first line co...read more
Q93. how would you handle overflow condition of an array? SB37,SD37,SE37,S0C4,S0C7?JCL - how to backup all GDG versions in one step? what are COMP & COMP-3 vars and what it's used for?
Handling overflow condition of an array and backing up GDG versions in one step in JCL
For overflow, check array bounds before accessing elements
For SB37, increase primary/secondary space allocation
For SD37, increase directory blocks
For SE37, increase primary/secondary space allocation for PDS
For S0C4, check for null pointers or uninitialized variables
For S0C7, check for invalid data types or out-of-bounds array access
To backup all GDG versions in one step, use the GDG base na...read more
Q94. Count Derangements Problem Statement
You are tasked with finding the total number of derangements for a given set of elements. Specifically, for an integer N
, determine how many ways there are to permute a set ...read more
Q95. 1. How to make object thread-safe? 2. Create an Immutable class. 3. Which Garbage collection algorithm is used in Java. 4. print the left view of the Binary tree 5. working of Circuiter breaker design pattern....
read moreTechnical interview questions for Associate Staff Engineer position
To make an object thread-safe, use synchronization or use thread-safe data structures
Immutable class is a class whose state cannot be modified after creation
Java uses a mark-and-sweep algorithm for garbage collection
To print the left view of a binary tree, perform a level order traversal and print the first node at each level
Circuit breaker design pattern is used to prevent cascading failures in distributed sy...read more
Q96. Difference between microflow flow and nano flow
Microflow is a flow with a rate of 1-1000 µL/min while nano flow is a flow with a rate of 1-1000 nL/min.
Microflow is used in HPLC and capillary electrophoresis while nano flow is used in nano-LC and proteomics.
Microflow requires larger sample volumes while nano flow requires smaller sample volumes.
Microflow has lower sensitivity compared to nano flow.
Q97. Factorial Calculation Problem Statement
Develop a program to compute the factorial of a given integer 'n'.
The factorial of a non-negative integer 'n', denoted as n!
, is the product of all positive integers les...read more
Q98. write a program: if input is "my_first_variable" return output as "myFirstVariable" and vice-versa
A program to convert a variable name from snake_case to camelCase and vice-versa.
Split the input string by underscore (_) to get an array of words.
For snake_case to camelCase conversion, capitalize the first letter of each word except the first one.
For camelCase to snake_case conversion, insert an underscore (_) before each capital letter except the first one.
Join the array of words with the appropriate delimiter to get the converted variable name.
Q99. DFS Traversal Problem Statement
Given an undirected and disconnected graph G(V, E)
, where V
is the number of vertices and E
is the number of edges, the connections between vertices are provided in the 'GRAPH' m...read more
Q100. How to write HTML code considering web accessibility for disabled person
Consider web accessibility guidelines for disabled persons when writing HTML code.
Use semantic HTML elements like <nav>, <header>, <main>, <footer> to improve screen reader accessibility.
Provide alternative text for images using the alt attribute.
Ensure proper color contrast for text and background to aid visually impaired users.
Use ARIA roles and attributes to enhance accessibility for interactive elements.
Test your website using screen readers and keyboard navigation to ide...read more
More about working at Nagarro
Top HR Questions asked in Pioneer Valves & Flow Control
Interview Process at Pioneer Valves & Flow Control
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month