Raja Software Labs
30+ Vaigai Transport Interview Questions and Answers
Q1. 1 print string without taking repeating characters eg helper - helpr
The task is to print a string without any repeating characters.
Iterate through the string and keep track of the characters seen so far.
If a character is already seen, skip it.
Otherwise, add it to the output string.
Return the output string.
Q2. angle between hour and minute hand of clock at a given time
The angle between hour and minute hand of a clock at a given time.
Calculate the angle made by the hour hand with 12 o'clock
Calculate the angle made by the minute hand with 12 o'clock
Find the difference between the two angles
If the difference is greater than 180 degrees, subtract it from 360 degrees
The result is the angle between the hour and minute hand
Q3. 2 given sum and we have to print all the subsequences in array with given sum
Printing all the subsequences in an array with a given sum.
Use recursion to generate all possible subsequences.
Check if the sum of each subsequence is equal to the given sum.
Print the subsequences that satisfy the condition.
Time complexity: O(2^n).
Q4. 2 sort array of 0s and 1s in only one loop solution was using two pointers
Sort an array of 0s and 1s in one loop using two pointers.
Use two pointers, one starting from the beginning and the other from the end.
Swap the values at the pointers if the value at the beginning pointer is greater than the value at the end pointer.
Continue until the pointers meet in the middle.
Time complexity is O(n).
Q5. Occurance of characters in string
The question is about finding the occurrence of characters in a string.
Iterate through the string and count the occurrence of each character.
Use a hash table to store the count of each character.
Consider the case sensitivity of the characters.
Handle special characters and spaces as required.
Q6. 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
Q7. Reverse Words in a String: Problem Statement
You are given a string of length N
. Your task is to reverse the string word by word. The input may contain multiple spaces between words and may have leading or trai...read more
Q8. sort a binary array using one traversal and no extra space
Sort a binary array using one traversal and no extra space.
Use two pointers, one starting from the beginning and one from the end of the array.
Swap the elements if the left pointer points to 1 and the right pointer points to 0.
Continue traversing until the pointers meet in the middle.
Q9. find minimum angle between hour and minute hand.
Find minimum angle between hour and minute hand.
Calculate the angle made by hour hand with 12 o'clock position and minute hand with 12 o'clock position.
Calculate the difference between the two angles.
If the difference is greater than 180 degrees, subtract it from 360 degrees to get the minimum angle.
Q10. 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
Q11. Maximum Difference Problem Statement
Given an array ARR
of N
elements, your task is to find the maximum difference between any two elements in ARR
.
If the maximum difference is even, print EVEN; if it is odd, p...read more
Q12. We have given a integer array then find the second maximum difference ?
Find the second maximum difference in an integer array.
Sort the array in descending order
Calculate the difference between adjacent elements
Return the second maximum difference
Q13. Remainder When Divided By 11 Problem Statement
Determine the remainder when a given number, 'N' in the form of a string, is divided by 11.
Input:
The first line contains an integer 'T' denoting the number of te...read more
Q14. Selection Sort Algorithm
Selection sort is a sorting technique that works by repeatedly finding the minimum element (considering ascending order) from the unsorted part and placing it at the beginning of the un...read more
Q15. We have given a integer find the sum of all digits.
Given an integer, find the sum of all its digits.
Convert the integer to a string and iterate over each character to get the sum.
Use modulo operator to get the last digit and add it to the sum, then divide by 10 to remove the last digit.
Recursively call the function with the integer divided by 10 and add the remainder to the sum.
Q16. String Palindrome Verification
Given a string, your task is to determine if it is a palindrome considering only alphanumeric characters.
Input:
The input is a single string without any leading or trailing space...read more
Q17. Find the minimum number of coins to make a given value. (Coin Change)
Find minimum number of coins to make a given value using dynamic programming.
Use dynamic programming to find the minimum number of coins needed.
Create a dp array to store the minimum number of coins for each value up to the given value.
Iterate through each coin denomination and update the dp array accordingly.
Return the value at the given value index in the dp array.
Q18. Star Pattern Problem Statement
Display the star pattern for a given positive integer N.
Example:
Input:
N = 4
Output:
*
***
*****
*******
Explanation:
The dots in the image represent spaces. Align the stars in...read more
Q19. 0, 1 array sort (keep complexity low)
Sort an array of 0s and 1s with low complexity.
Use two pointers, one at the beginning and one at the end of the array.
Swap 0s from the beginning with 1s from the end until the pointers meet.
Time complexity: O(n), space complexity: O(1).
Q20. Parenthesis balancing Reversing the string Finding the angle between hour and minute hand of clock
Three technical questions related to string manipulation and clock calculations.
For parenthesis balancing, use a stack data structure to keep track of opening and closing brackets.
To reverse a string, use two pointers starting from the beginning and end of the string and swap characters until they meet in the middle.
To find the angle between hour and minute hand of clock, use the formula (30H - 11/2M) degrees, where H is the hour and M is the minute.
Q21. maximum span of 1 in a 0,1 array
Find the maximum span of 1 in a 0,1 array.
Iterate through the array and keep track of the first and last occurrence of 1.
Calculate the difference between the last and first occurrence of 1.
Repeat the process for all 1's in the array and return the maximum difference.
Q22. Find first non repeated character in string?
Find the first non-repeated character in a string.
Iterate through the string and count the frequency of each character.
Return the first character with a count of 1.
Q23. First non repeating character in a string
Find the first non-repeating character in a string.
Create a hash table to store character frequency
Iterate through the string and update the hash table
Iterate through the string again and return the first character with frequency 1
Q24. Longest substring pallandrome in a string
Find the longest substring that is a palindrome in a given string.
Use dynamic programming to solve the problem efficiently.
Create a 2D boolean array to store the results of subproblems.
Check for palindromes of length 1 and 2 separately.
For substrings of length greater than 2, check if the first and last characters are the same and the substring between them is also a palindrome.
Update the result if a longer palindrome is found.
Q25. First non repeating Character
Find the first non-repeating character in a string.
Create a hash table to store the frequency of each character in the string.
Iterate through the string and update the frequency in the hash table.
Iterate through the string again and return the first character with a frequency of 1.
Q26. Prime no Add all digits in a number
The question asks to check if a number is prime and add all its digits.
To check if a number is prime, we can use a loop to divide it by all numbers from 2 to its square root.
If the number is divisible by any of these numbers, it is not prime.
To add all digits in a number, we can use a loop to extract each digit and add it to a running total.
Q27. Second Maximum Number in Array
Find the second maximum number in an array of strings.
Convert the array of strings to an array of integers.
Sort the array in descending order.
Return the second element in the sorted array.
Q28. find prime numbers value.
A prime number is a number greater than 1 that is divisible only by 1 and itself.
Start with a loop to iterate through numbers
Check if each number is divisible by any number from 2 to its square root
If not divisible, add it to the list of prime numbers
Q29. nearest Prime number
To find the nearest prime number, iterate from the given number in both directions until a prime number is found.
Start iterating from the given number in both directions to find the nearest prime number.
Check if a number is prime by dividing it by all numbers less than its square root.
Keep track of the closest prime number found during the iteration.
Q30. 2nd smallest number
Find the 2nd smallest number in an array of integers.
Sort the array in ascending order
Return the second element in the sorted array
Q31. How to find the reverse of a string of a particular order seperated by dots.
To reverse a string of a particular order separated by dots, split the string into an array, reverse the array, and join it back into a string.
Split the string using the dot separator
Reverse the resulting array
Join the array back into a string using the dot separator
Q32. How to find the year is leap or not using single if condition.
To find leap year using single if condition
Check if year is divisible by 4 and not divisible by 100
Or check if year is divisible by 400
If either of the above conditions is true, then it's a leap year
Q33. What do you know about medicine and its distribution in worldwide
Medicine distribution involves manufacturing, regulation, transportation, and sales of pharmaceutical products globally.
Medicine distribution is a complex process involving various stakeholders such as manufacturers, distributors, pharmacies, and healthcare providers.
Regulatory bodies like the FDA in the US and the EMA in Europe play a crucial role in ensuring the safety and efficacy of medicines.
Global pharmaceutical companies like Pfizer, Novartis, and Roche have a signific...read more
Q34. find if the given year is a leap year or not.
Check if a given year is a leap year or not.
A leap year is divisible by 4, but not by 100 unless it is also divisible by 400
For example, 2000 is a leap year because it is divisible by 400, while 1900 is not because it is divisible by 100 but not by 400
Q35. Sorting algorithms and their implementations
Sorting algorithms are used to arrange elements in a specific order.
Common sorting algorithms include bubble sort, selection sort, insertion sort, merge sort, quick sort, and heap sort.
Each sorting algorithm has its own time complexity and space complexity.
Sorting algorithms can be implemented in various programming languages such as C++, Java, Python, etc.
Q36. Finding spaces in string
To find spaces in a string, use the split() method and count the resulting array length minus one.
Use the split() method with a space as the delimiter
Count the length of the resulting array minus one
Example: 'Hello World'.split(' ').length - 1 returns 1
Q37. How it defines
The question is unclear. Please provide more context.
Can you please clarify the question?
What is 'it' referring to?
Without more information, I cannot provide a clear answer.
More about working at Raja Software Labs
Top HR Questions asked in Vaigai Transport
Interview Process at Vaigai Transport
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month