
Procol

Procol Software Developer Intern Interview Questions and Answers
Q1. Power of a Number Problem
You are given two integers, X
and N
. Your task is to compute the value of X
raised to the power of N
(i.e., X^N
).
Input:
The first line contains an integer T
, the number of test cases....read more
Compute the value of X raised to the power of N for given integers X and N.
Read the number of test cases T
For each test case, read the values of X and N
Calculate X^N for each test case
Print the result of X^N for each test case
Q2. Minimum Operations to Equalize Array
Given an integer array ARR
of length N
where ARR[i] = (2*i + 1)
, determine the minimum number of operations required to make all the elements of ARR
equal. In a single opera...read more
The minimum number of operations required to make all elements of the given array equal.
Calculate the target value as the sum of all elements divided by the length of the array.
Find the absolute difference between each element and the target value to determine the number of operations needed.
Return the sum of all absolute differences as the minimum number of operations required.
Q3. Game of Dominoes Problem Statement
Rafiq loves to play with piles of dominoes, especially when they are of equal heights. His father gifted him 'N' piles of dominoes, each with a positive number of stacked domi...read more
Calculate minimum cost to make consecutive windows of domino piles equal in height.
Iterate through each window of size K and calculate the minimum cost to make piles equal in height.
Keep track of the running sum of domino heights in each window.
For each window, find the median height and calculate the cost to make all piles equal to the median height.
Q4. String Ka Khel Problem Statement
Ninja is creating a new game ‘String Ka Khel’ for his gaming shop. In this game, players are given ‘N’ strings. The objective is to find the maximum length of strings that can b...read more
Compute the maximum length of a string that can be formed by joining given strings based on a specific condition.
Iterate through each string and store the count of strings ending with 'R' and 'B'.
Check if there are any strings ending with 'R' and 'B' that can be combined to form a longer string.
Return the maximum length of the string that can be formed or 0 if no combination is possible.
Implement Stack with Linked List
Your task is to implement a Stack data structure using a Singly Linked List.
Explanation:
Create a class named Stack
which supports the following operations, each in O(1) time:
Implement a Stack data structure using a Singly Linked List with operations in O(1) time.
Create a class named Stack with methods getSize, isEmpty, push, pop, and getTop.
Use a Singly Linked List to store the elements of the stack.
Ensure each operation runs in O(1) time complexity.
Handle edge cases like empty stack appropriately.
Implement the logic for each operation as specified in the question.
Test the implementation with sample input and output provided in the question.
Q6. 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
Find pairs of elements in an array that sum up to a given value, sorted in a specific order.
Iterate through the array and for each element, check if the complement exists in a hash set.
Sort the pairs based on the first element and then the second element.
Use a hash set to store elements as you iterate through the array to avoid duplicates.
Return the list of pairs that satisfy the sum condition.
Q7. Search in Infinite Sorted 0-1 Array Problem Statement
You are provided with an infinite sorted array that consists exclusively of 0s followed by 1s. Your task is to determine the index of the first occurrence o...read more
Find the index of the first occurrence of 1 in an infinite sorted 0-1 array.
Use binary search to efficiently find the index of the first occurrence of 1.
Keep doubling the search range until you find a range that contains 1.
Update the search range based on the value at the mid index.
Return the index of the first occurrence of 1 once found.

Top Software Developer Intern Interview Questions from Similar Companies







Reviews
Interviews
Salaries
Users/Month

