Wipro Coding Questions

Wipro Limited is a leading global information technology, consulting, and business process services company. Headquartered in Bangalore, India, Wipro has a rich history of innovation and excellence, serving clients across various industries worldwide.

History and Evolution

Founded in 1945 by M.H. Hasham Premji as Western India Vegetable Products Limited, the company initially focused on vegetable and refined oils. Under the leadership of Azim Premji, the company diversified into the IT sector in the 1980s, marking the beginning of its transformation into a global IT powerhouse.

Core Services

Wipro offers a wide range of services, including:

  • IT Services: Application development, maintenance, and modernization.
  • Consulting: Business and technology consulting to drive digital transformation.
  • Business Process Services: Outsourcing and automation of business processes.
  • Cloud and Infrastructure Services: Cloud computing, cybersecurity, and infrastructure management.


Wipro Common Coding Questions

  1. Find the nearest greater element to the right for each element in an array.
  2. Calculate the minimum deletions to make a string a palindrome.
  3. Check if two binary trees are identical.
  4. Determine if a subset with a target sum exists in an integer set.
  5. Find the first non-repeating character in a string.
  6. Find the smallest missing positive integer in an unsorted array.
  7. Reverse a linked list and explain its time complexity.
  8. Find the depth of a binary tree.
  9. Implement a breadth-first search (BFS) traversal of a graph.
  10. Check for balanced parentheses in an expression.
  11. Reverse the words in a given sentence while keeping the order.
  12. Check if a string is a palindrome.
  13. Verify if two strings are anagrams.
  14. Implement a function to locate a substring in a main string.
  15. Find an element in a sorted array using binary search.
  16. Sort an array using quick sort.
  17. Implement merge sort for an integer array.
  18. Sort an array of strings by length without using built-in functions.
  19. Generate the nth Fibonacci series using recursion.
  20. Solve the 0/1 knapsack problem using dynamic programming.
  21. Check if a subset with a given sum exists in an array.
  22. Find the longest common subsequence between two strings.

Wipro Elite 2025 Coding questions

1. Divisible Within Range

You are given number x and y. U need to find all numbers in range x and y both inclusive which are divisible by x

Sample Input 1: 3 18

Sample output 1: 6

Explanation: 3 6 9 12 15 18

2. Nth Term of Arithmetic progression

You are given a, d and n which represents A = first term of AP D = common difference in AP N = term that we need to find

Formula for calculating nth term: Nth term = a + (n-1)*d

Sample Input 1: 2 3 8

Sample output 1: 23

Wipro Elite 2024 Coding questions

3. Third Last Consonant

You are given a string, str. Print the third last consonant of str.

Note:

  1. str will always have more than or equal to 3 consonants.
  2. All the letters in the English alphabet other than vowels (a, e, i, o, u) are consonants.

Input Format:

Each test case consists of two lines of input,

  • The first line contains a single integer, i.e. the length of the string str.
  • The second line contains a string, i.e. str.

Input will be read from the STDIN by the candidate

Output Format:

  • The output consists of a single character, i.e. the third last consonant of str.

The output will be matched to the candidates output printed on the STDOUT

Constraints: 0 < length of the string str < 10^9

Example:

Input:

9
asdfguihj

Output: g

Explanation: g is the third last consonant in asdfguihj

Sample input:

4
hijk

Sample Output: h


4. Product of Numbers

You are given an integer n. Find and print the product of all the numbers from 1 to n.

Note: Computed value lies within the integer range.

Input Format: The test case consists of a single line of input:

  • The line contains a single integer, i.e. n.

Input will be read from the STDIN by the candidate

Output Format: Print the product of all the numbers from 1 to n.

The output will be matched to the candidate's output printed on the STDOUT

Constraints: 0 < n < 13

Example:

Input: 5

Output: 120

Explanation: For input 5, the output is 1 × 2 × 3 × 4 × 5 = 120.

Sample input: 4

Sample Output: 24


5. Sum of Divisors

You are given an integer n find and print the sum of all of its divisors starting from 1.

Note: • Sum lies within the integer range.

Input Format: The input consists of a single line of input:

  • The line contains a single integer, i.e. n.

Input will be read from the STDIN by the candidate

Output Format: The output will be a single integer, i.e. the sum of all its divisors starting from 1.

The output will be matched to the candidate's output printed on the STDOUT

Constraints: 0 < n < 10^9

Example: Input: 6

Output: 12

Explanation: Divisors of 6 are {1, 2, 3, 6} Sum = 1 + 2 + 3 + 6 = 12, hence the output is 12.

Sample input: 12

Sample Output: 28


6. Longest Increasing Subsequence

You are given an array arr of size N. Your task is to re-order the array and find the length of the longest increasing sub-sequence from that re-ordered array and print the same as the output.

A sub-sequence of a given sequence is a sequence that can be derived from the given sequence by deleting some or no elements without changing the order of the remaining elements.

Input Format: The input is in the following format:

  • The first line contains N, denoting the number of elements in the array arr.
  • Then, N subsequent lines contain a single integer, denoting the value of the ith element of the array.

The input will be read from the STDIN by the candidate

Output Format: Print the length of the longest increasing sub-sequence after re-ordering the given array.

The output will be matched to the candidate's output printed on the STDOUT

Constraints: • 1 ≤ N ≤ 10^5 • 1 ≤ arr[i] ≤ 10^5

Example: Input:

5
5
3
3
3
1

Output: 3

Explanation: Let's re-order the elements, as (1,3,5,3,3). Now, we can find the longest increasing sub-sequence of this, which will be (1,3,5), and its length is 3. There can be several other re-orderings of the array, but the longest increasing sub-sequence size that we can obtain for this particular array is 3, which is thus, the answer to the problem.

Sample input:

2
1
1

Sample Output: 1


7. Power Calculation

In physics, power is the amount of energy transferred or converted per unit time, which is power=energy/time. You are given energy output and time taken for two power generators. Calculate and print the total power generated from both the generators. In case of decimal values of power, use floor value.

Input Format: The input consists of four lines:

  • The first line contains an integer denoting the energy of the first generator (E1).
  • The second line contains an integer denoting the time taken by the first generator (T1).
  • The third line contains an integer denoting the energy of the second generator (E2).
  • The fourth line contains an integer denoting the time taken by the second generator (T2).

The input will be read from the STDIN by the candidate

Output Format: Print the total power generated.

The output will be matched to the candidate's output printed on the STDOUT

Constraints: • 1 ≤ T1 ≤ E1 ≤ 100000 • 1 ≤ T2 ≤ E2 ≤ 100000

Example: Input:

520
3
100
1

Output: 273

Explanation: Power from first generator 1 is 520/3 = 173.33 after flooring the value we get 173. Power from first generator 2 is 100/1 = 100. Total power generated is 173+100 = 273.

Sample input:

10000
50
200
5

Sample Output: 240


8. CamelCase to UpperCase

John wrote a sequence of words in CamelCase as a string of letters s, having the following properties:

  • The string s is a concatenation of one or more words consisting of English letters.
  • All the letters of the first word are in lowercase.
  • For each of the subsequent words, the first letter is in uppercase, and the rest of the letters are in lowercase. Given s, print each word in s in a new line after converting all the uppercase characters into lowercase and all the lowercase characters into uppercase. For example, s = oneTwoThree. Print each word i.e., ONE, TWO, THREE on a new line.

Input Format: The input consists of a single line:

  • The line contains a string s.

The input will be read from the STDIN by the candidate

Output Format: Print each word in s separated by a line after converting the case of the letters.

The output will be matched to the candidate's output printed on the STDOUT

Constraints: • 1 ≤ length of s ≤ 10^5

Example: Input: saveChangesInTheEditor

Output:

SAVE
CHANGES
IN
THE
EDITOR

Explanation: String s contains five words. So, print each word in a new line with the count of the word in the string.

Sample input: hiHello

Sample Output:

HI
HELLO

9. Case Toggle

You are given a single character c. The character c lies between [a - z] or [A - Z]. If the character is in the upper case then you are required to change the case of character to lower case and print the same. If it is in the lower case, change it to upper case and print the same.

Input Format: Input consists of a single line:

  • The line contains a single character i.e., c.

Input will be read from the STDIN by the candidate

Output Format: The output consists of a single character i.e. the changed character.

The output will be matched to the candidate's output printed on the STDOUT

Constraints: • The character c lies between [a - z] or [A - Z].

Example: Input: a

Output: A

Explanation: Since character 'a' is a lower case alphabet, it is changed to an upper case alphabet 'A', hence 'A' is printed.

Sample input: C

Sample Output: c

10. Maximum Product

Given two ranges (L1, R1) and (L2, R2). You need to find two numbers a and b, such that L1 ≤ a ≤ R1 and L2 ≤ b ≤ R2, and the product of a and b is maximum.

Input Format: The input consists of a single line:

  • The line contains four space-separated integers denoting L1, R1, L2, and R2 respectively.

Input will be read from the STDIN by the candidate

Output Format: Print the maximum product of a and b.

The output will be matched to the candidate's output printed on the STDOUT

Constraints: • -10³ ≤ L1 ≤ R1 ≤ 10³. • -10³ ≤ L2 ≤ R2 ≤ 10³.

Example: Input: 1 3 -2 6

Output: 18

Explanation: The ranges are (1, 3) and (-2, 6). So the maximum product of a, b such that 1 <= a <= 3 and -2 <= b <= 6 is (3*6)=18.

Sample input: 1 2 3 4

Sample Output: 8


11. Pythagorean Theorem

You are given two integers A and B. A represents a coordinate on the X-axis(A,0) and B represents a coordinate on the Y-axis (0,B). These are two co-ordinate points of a right-angled triangle, the third point being the origin(0,0). You will be given N such triangles in the input. Find the hypotenuse of all the triangles.

Note:

  • The formula of the length of a hypotenuse = root(a² + b²) where a and b represent the length of the other two sides of the triangle.
  • If the length of the hypotenuse is in decimal, round it to the next greater integer.

Input Format: The input consist is given in the following format:

  • The first line contains an integer N denoting the number of triangles.
  • The next N lines contain two space-separated integers representing A and B respectively.

The input will be read from the STDIN by the candidate

Output Format: The output consists of N lines:

  • Each line representing the length of the hypotenuse of the iᵗʰ triangle.

The output will be matched to the candidate's output printed on the STDOUT

Constraints: • 1 ≤ A, B ≤ 10⁹

Example: Input:

2
20 21
8 15

Output: 29


12. Even Odd

You are given a number N. If N is odd then print the value of the product of digits of the number N otherwise print the value of the sum of digits of the number N.

Input Format: The input consist of a single line:

  • The line contains an integer, i.e. N.

Input will be read from the STDIN by the candidate

Output Format: If N is odd then print the value of the product of digits of the number N otherwise print the value of the sum of digits of the number N.

The output will be matched to the candidate's output printed on the STDOUT

Constraints: • 1 ≤ N ≤ 10^8.

Example: Input: 11

Output: 1

Explanation: 11 is odd hence the value of the product of the digits of 11 is 1*1=1.

Sample input: 464

Sample Output: 14


TCS NQT Previous year Coding questions

Cognizant Coding questions

Join our Whatsapp channel for more resources