Bajaj Finserv Health
Wipro Interview Questions and Answers
Q1. Ninja And The Fence Problem Statement
Ninja is given a task of painting a fence with ‘N’ posts using ‘K’ different colors. The task requires that not more than two adjacent posts have the same color. Your goal ...read more
The task is to determine the number of ways to paint a fence with 'N' posts using 'K' different colors, with the constraint that not more than two adjacent posts have the same color.
Use dynamic programming to solve the problem efficiently.
Consider the cases where the last two posts have the same color and different colors separately.
Keep track of the number of ways to paint the fence at each post using a 2D array.
Apply modulo 10^9 + 7 to avoid overflow issues.
Return the final...read more
Q2. Reverse the String Problem Statement
You are given a string STR
which contains alphabets, numbers, and special characters. Your task is to reverse the string.
Example:
Input:
STR = "abcde"
Output:
"edcba"
Input...read more
Reverse a given string containing alphabets, numbers, and special characters.
Iterate through the string from the end to the beginning and append each character to a new string.
Use built-in functions like reverse() or slicing to reverse the string.
Handle special characters and numbers while reversing the string.
Ensure to consider the constraints on the length of the string and number of test cases.
Q3. Delete a Node from Linked List Problem Statement
Given a linked list of integers, your task is to implement a function that deletes a node at a specified position, 'POS'.
If the specified position is greater th...read more
Implement a function to delete a node at a specified position in a linked list.
Traverse the linked list to find the node at the specified position.
Update the pointers to skip over the node to be deleted.
Handle edge cases like deleting the head or tail of the linked list.
Return the modified linked list.
Q4. what is the angle between minute and hour hand at 1:15
The angle between the minute and hour hand at 1:15 is 7.5 degrees.
At 1:15, the minute hand is at 3 and the hour hand is slightly past 1
Calculate the angles covered by each hand from 12 o'clock position
Subtract the smaller angle from the larger angle to get the angle between the hands
Q5. 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
Count the total number of unique pairs in an array whose elements sum up to a given value.
Use a hashmap to store the frequency of each element in the array.
Iterate through the array and for each element, check if (Sum - current element) exists in the hashmap.
Increment the count of pairs if the complement exists in the hashmap.
Divide the count by 2 to avoid counting duplicates like (arr[i], arr[j]) and (arr[j], arr[i]) separately.
Q6. sell me pen? I want to replace the screen of my phone as it is broken, now try to convince me to buy a new phone in place of replacing the screen of my old phone
Replacing the screen of your old phone may not be cost-effective in the long run. Buying a new phone can offer better features and performance.
Replacing the screen may not fix other potential issues with the phone
A new phone may offer better camera, battery life, and processing power
You can take advantage of new technology and features with a new phone
The cost of replacing the screen may be close to the cost of a new phone
A new phone may come with a warranty and better custom...read more
Q7. What is the event loop in javascript?
The event loop in JavaScript is responsible for handling asynchronous operations by continuously checking the call stack and the callback queue.
The event loop continuously checks the call stack for any functions that need to be executed.
If the call stack is empty, the event loop checks the callback queue for any asynchronous tasks that have completed.
The event loop then pushes these tasks onto the call stack for execution.
Example: setTimeout() function in JavaScript uses the ...read more
Q8. What are closures in javascript?
Closures in JavaScript are functions that have access to variables from their outer scope even after the outer function has finished executing.
Closures allow functions to access variables from their outer scope
They are created when a function is defined within another function
Closures can be used to create private variables and functions
Interview Process at Wipro
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month