Wipro
20+ AmBoxDemo-South Interview Questions and Answers
Q1. Minimum Operations to Make Strings Equal
Given two strings, A
and B
, consisting of lowercase English letters, determine the minimum number of pre-processing moves required to make string A
equal to string B
usi...read more
Determine the minimum number of pre-processing moves required to make two strings equal by swapping characters and replacing characters in one string.
Iterate through both strings simultaneously and count the number of characters that need to be swapped.
Consider all possible swaps and replacements to find the minimum number of pre-processing moves.
If the lengths of the strings are different, it's impossible to make them equal.
Handle edge cases like empty strings or strings wit...read more
Q2. Linear Search Problem Statement
Given a random integer array/list ARR
of size N
, and an integer X
, you are required to search for the integer X
in the given array/list using Linear Search.
Return the index at w...read more
Linear search algorithm to find the first occurrence of an integer in an array.
Iterate through the array and compare each element with the target integer.
Return the index if the target integer is found, else return -1.
Time complexity is O(N) where N is the size of the array.
Q3. Minimum Operations Problem Statement
You are given an array 'ARR'
of size 'N'
consisting of positive integers. Your task is to determine the minimum number of operations required to make all elements in the arr...read more
The minimum number of operations needed to make all elements of the array equal by performing addition, multiplication, subtraction, or division on any element.
Iterate through the array and find the maximum and minimum values
Calculate the difference between the maximum and minimum values
Check if the difference is divisible by the length of the array
If divisible, return the difference divided by the length
If not divisible, return the difference divided by the length plus one
Q4. K-th Permutation Sequence Problem Statement
Given two integers N
and K
, your task is to find the K-th permutation sequence of numbers from 1 to N
. The K-th permutation is the K-th permutation in the set of all ...read more
Find the K-th permutation sequence of numbers from 1 to N.
Generate all permutations of numbers from 1 to N using backtracking or next_permutation function.
Sort the permutations in lexicographical order.
Return the K-th permutation from the sorted list.
Q5. Minimum Cost to Buy Oranges Problem Statement
You are given a bag of capacity 'W' kg and a list 'cost' of costs for packets of oranges with different weights. Each element at the i-th position in the list indic...read more
Find the minimum cost to buy a specific weight of oranges given the cost of different weight packets.
Iterate through the list of costs and find the minimum cost to achieve the desired weight
Use dynamic programming to keep track of the minimum cost for each weight up to the desired weight
Handle cases where the desired weight cannot be achieved with the available packet weights
Q6. Remove Leaf Nodes from a Tree
In this problem, you are tasked to remove all the leaf nodes from a given generic tree. A leaf node is defined as a node that does not have any children.
Note:
The root itself can ...read more
Remove all leaf nodes from a generic tree.
Traverse the tree in post-order fashion to remove leaf nodes.
Check if a node is a leaf node (no children), then remove it.
Update the parent node's children list after removing leaf nodes.
Repeat the process for all nodes in the tree.
Return the updated root of the tree after removing all leaf nodes.
Q7. Palindromic Substrings Problem Statement
Given a string STR
, your task is to find the total number of palindromic substrings of STR
.
Example:
Input:
STR = "abbc"
Output:
5
Explanation:
The palindromic substring...read more
Count the total number of palindromic substrings in a given string.
Iterate through each character in the string and expand around it to find palindromic substrings.
Use dynamic programming to optimize the solution by storing previously calculated palindromic substrings.
Consider both odd-length and even-length palindromes while counting.
Example: For input 'abbc', the palindromic substrings are ['a', 'b', 'b', 'c', 'bb'], totaling 5.
Q8. Segregate Odd-Even Problem Statement
In a wedding ceremony at NinjaLand, attendees are blindfolded. People from the bride’s side hold odd numbers, while people from the groom’s side hold even numbers. For the g...read more
Rearrange a linked list such that odd numbers appear before even numbers, preserving the order of appearance.
Iterate through the linked list and maintain two separate lists for odd and even numbers.
Merge the two lists while preserving the order of appearance.
Ensure to handle cases where there are no odd or even numbers in the list.
Q9. Merge Sort Problem Statement
You are given a sequence of numbers, ARR
. Your task is to return a sorted sequence of ARR
in non-descending order using the Merge Sort algorithm.
Explanation:
The Merge Sort algorit...read more
Implement Merge Sort algorithm to sort a sequence of numbers in non-descending order.
Divide the input array into two halves recursively until each array has only one element.
Merge the sorted halves to produce a completely sorted array.
Time complexity of Merge Sort is O(n log n).
Example: Input: [3, 1, 4, 1, 5], Output: [1, 1, 3, 4, 5]
Q10. Count Equal Elements Subsequences
Given an integer array/list ARR
of size N
, your task is to compute the total number of subsequences where all elements are equal.
Explanation:
A subsequence of a given array is...read more
Count the total number of subsequences where all elements are equal in an integer array.
Iterate through the array and count the frequency of each element.
Calculate the total number of subsequences for each element using the formula (frequency * (frequency + 1) / 2).
Sum up the total number of subsequences for all elements and return the result modulo 10^9 + 7.
Q11. Prime Numbers Retrieval Task
You are provided with a positive integer 'N'. Your objective is to identify and return all prime numbers that are less than or equal to 'N'.
Example:
Input:
T = 1
N = 10
Output:
2, 3...read more
Return all prime numbers less than or equal to a given positive integer N.
Iterate from 2 to N and check if each number is prime
Use a boolean array to mark non-prime numbers
Optimize by only checking up to square root of N for divisibility
Q12. XOR Pair Grouping Problem
You are given an array A
of size N
. Determine whether the array can be split into groups of pairs such that the XOR of each pair equals 0. Return true
if it is possible, otherwise retu...read more
Determine if an array can be split into pairs with XOR 0.
Check if the count of each element in the array is even.
Use a hashmap to store the frequency of each element.
Iterate through the hashmap and check if the count of any element is odd.
Q13. Merge Sort Algorithm Problem Statement
Your task is to sort a sequence of numbers stored in the array ‘ARR’ in non-descending order using the Merge Sort algorithm.
Explanation:
Merge Sort is a divide-and-conque...read more
Implement Merge Sort algorithm to sort a sequence of numbers in non-descending order.
Divide the input array into two halves recursively
Sort the two halves separately
Merge the sorted halves to produce a fully sorted array
Time complexity of Merge Sort is O(n log n)
Example: Input - [5, 2, 8, 3, 1], Output - [1, 2, 3, 5, 8]
Q14. Count Subsequences Problem Statement
Given an integer array ARR
of size N
, your task is to find the total number of subsequences in which all elements are equal.
Explanation:
A subsequence of an array is derive...read more
The task is to find the total number of subsequences in which all elements are equal in an integer array.
Iterate through the array and count the frequency of each element.
For each element, calculate the number of subsequences with all elements equal using the formula (frequency * (frequency - 1) / 2).
Sum up the counts for all elements to get the total number of subsequences where all elements are equal.
Q15. 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
Find the maximum difference between any two elements in an array and determine if it is even or odd.
Iterate through the array to find the maximum and minimum elements
Calculate the difference between the maximum and minimum elements
Check if the difference is even or odd and return the result
Q16. Longest Common Subsequence Problem Statement
Given two Strings STR1
and STR2
, determine the length of their longest common subsequence.
A subsequence is a sequence derived from another sequence by deleting some...read more
Find the length of the longest common subsequence between two given strings.
Use dynamic programming to solve this problem efficiently.
Create a 2D array to store the lengths of common subsequences.
Iterate through the strings to fill the array and find the longest common subsequence length.
I have applied logical reasoning in various situations, such as problem-solving tasks and decision-making processes.
Analyzing data to identify patterns and trends
Creating algorithms to optimize processes
Solving complex problems by breaking them down into smaller, manageable parts
Making informed decisions based on available information
The solution to the automata coding question involves designing a finite state machine to recognize a specific pattern or language.
Understand the requirements of the automata problem and define the states, transitions, and final states.
Implement the finite state machine using a programming language like Python or C++.
Test the automata with different inputs to ensure it correctly recognizes the desired pattern.
Optimize the automata design for efficiency if needed.
Example: Desi...read more
Q19. If any bond period is there are not?
It depends on the company and the job offer. Some companies have bond periods while others don't.
Bond periods are contractual agreements between the employer and employee.
They usually require the employee to work for a certain period of time before leaving the company.
Bond periods can vary in length and may have financial penalties for breaking the contract.
Not all companies have bond periods, so it's important to check the job offer or ask during the interview.
If there is a ...read more
Q20. How to build a secure software.
Building secure software requires a multi-layered approach.
Implement secure coding practices
Use encryption and authentication mechanisms
Regularly update and patch software
Conduct regular security audits and testing
Train employees on security best practices
Follow industry standards and regulations
Consider threat modeling and risk assessment
Q21. What's is different between c and c++
C++ is an extension of C with object-oriented programming features.
C++ supports object-oriented programming while C does not.
C++ has classes and templates while C does not.
C++ has better support for function overloading and default arguments.
C++ has a standard library that includes many useful functions.
C++ allows for both procedural and object-oriented programming.
C++ is generally considered to be a more complex language than C.
Q22. Who is the c language denoted
C language is a general-purpose, procedural computer programming language.
Developed by Dennis Ritchie at Bell Labs in 1972
Used for system programming, embedded systems, and application software
Influenced many other programming languages such as C++, Java, and Python
Q23. springboot annotations and advantages
SpringBoot annotations simplify development and provide various advantages.
Annotations like @RestController, @GetMapping, @PostMapping, etc. simplify the creation of RESTful web services.
SpringBoot annotations provide auto-configuration, reducing the need for boilerplate code.
Annotations like @Autowired and @Component simplify dependency injection.
Annotations like @Transactional simplify database transactions.
SpringBoot annotations provide easy integration with other framewor...read more
Q24. Wt are searching techniques
Searching techniques are methods used to find specific data or information within a larger set of data.
Linear search
Binary search
Hashing
Depth-first search
Breadth-first search
Top HR Questions asked in AmBoxDemo-South
Interview Process at AmBoxDemo-South
Top Software Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month