# TCS Digital Coding Questions

*TCS (25)*

*Capgemini (5)*

*Hewlett Packard Enterprise (5)*

*Ciena (16)*

*Adobe (5)*

*Alcatel-Lucent (6)*

*Ericsson (1)*

*Broadcom Ltd (18)*

*Radisys (6)*

*Aricent (8)*

*IpInfusion (1)*

*Cisco (28)*

*Brocade (20)*

*Wipro (25)*

*Cavium Networks (8)*

*XiLinx (3)*

*Juniper Network (10)*

*HCL Technologies (11)*

*Amazon (5)*

*IBM (23)*

*Global Edge (18)*

*Accenture (16)*

*Qualcomm (4)*

*CA Technologies (6)*

*Nagarro (8)*

*Tech Mahindra (1)*

*Syntel Inc. (10)*

*Tavant Technologies (15)*

*Amdocs (1)*

*Virtusa (36)*

*PEOL (15)*

*Sapient (3)*

*Societe Generale (4)*

*Wipro NLTH (23)*

*SAP Labs (18)*

*TCS NQT (23)*

*TCS Ninja (4)*

*TCS Digital (8)*

*Huawei (1)*

*Paytm (15)*

1 / 8

**Input : ** mat1[][] = {{1, 2},

{3, 4}}

mat2[][] = {{1, 1},

{1, 1}}

**Output : **

**Tags:**Paytm TCS Digital

2 / 8

**Input : ** 5 —Value of N

{10, 20, 30, 40, 50} —Element of Arr[ ]

2 —–Value of K

**Output : **

**Tags:**TCS Digital

3 / 8

**For example:**

Suppose n1=11 and n2=15.

There is the number 11, which has repeated digits, but 12, 13, 14 and 15 have no repeated digits. So, the output is 4.

**Input : ** 11 — Vlaue of n1

15 — value of n2

**Output : **

**Tags:**TCS Digital

4 / 8

Similarly, choose the smallest second palindromic substring that leaves a third palindromic sub-string.

If there is no way to split the word into exactly three palindromic substrings, print “Impossible” (without quotes). Every character of the string needs to be consumed.

Cases not allowed –

After finding 3 palindromes using above instructions, if any character of the original string remains unconsumed.

No character may be shared in forming 3 palindromes.

Constraints

1 <= the lngth of input sting <= 1000

**Input : ** First line contains the input string consisting of characters between [a-z].

**Output : **

**Tags:**TCS Digital

5 / 8

Calculate the number of all such permutations.

As this number can be large, print it modulo (1e9 +7).

Constraints

0 <= low <= high <= 10^9

K <= 10^6.

Input

First line contains two space separated integers denoting low and high respectively

Second line contains a single integer K.

Output

Print a single integer denoting the number of all such permutations Input

First line contains two space separated integers denoting low and high respectively

Second line contains a single integer K.

Output

Print a single integer denoting the number of all such permutations

**Input : ** 4 5

3

**Output : **

**Tags:**TCS Digital

6 / 8

Your task is that given the location of the first tree that catches fire, determine how long would it take for the entire forest to be on fire. You may assume that the lay out of the forest is such that the whole forest will catch fire for sure and that there will be at least one tree in the forest

Input Format:

First line contains two integers, M, N, space separated, giving the size of the forest in terms of the number of rows and columns respectively.

The next line contains two integers X,Y, space separated, giving the coordinates of the first tree that catches the fire.

The next M lines, where ith line containing N characters each of which is either T or W, giving the position of the Tree and Water in the ith row of the forest.

Output Format:

Single integer indicating the number of minutes taken for the entire forest to catch fire

**Input : ** 3 3

W T T

T W W

W T T

**Output : **

**Tags:**TCS Digital

7 / 8

Input Format

2 numbers a and b, separated by space.

Output Format

A single number greater than b.

If not possible, print -1

Constraints

1 <= a,b <= 10000000

**Input : ** 459 500

**Output : **

**Tags:**TCS Digital

8 / 8

For example, R = 2 and N = 3

All possible seating arrangements are

(1,2) & (3)

(1,3) & (2)

(2,3) & (1)

Attendees are numbered from 1 to N.

Input Format:

The first line contains T denoting the number of test cases.

Each test case contains two space separated integers R and N, Where R denotes the number of round tables and N denotes the number of attendees.

Output Format:

Single Integer S denoting the number of possible unique arrangements.

Constraints:

0 <= R <= 10(Integer)

0 < N <= 20 (Integer)

**Input : ** 1

2 5

**Output : **

**Tags:**TCS Digital

TCS Digital Coding round is one of the tricky rounds of the whole TCS hiring process, for this round You need to master TCS Digital coding questions, you need not only have any coding language (C/C++/Java/Perl/ Python 2.7) knowledge, even you need to have strong logical thinking, to code the questions in given time. On this page of TCS Digital, you can Practice similar type programming questions that are asked constantly in the TCS Digital test. Here you will get an updated pattern of the TCS Digital coding exam pattern 2021-22. This will help boost your preparation for the TCS Digital exam. To make your TCS Digital coding round preparation easy, we have listed here TCS Digital coding questions, you can practice all the given questions, and try to write the program in the given time. After practising these questions, you will be in a place to code most of the TCS Digital coding questions in given 20 minutes time in any of the 15 prefered programming languages:

- C
- C#
- C++
- Python
- Python3
- Erlang
- go
- Haskel
- Java
- Java 7
- Kotlin
- Lua
- Perl
- Ruby
- Scala

#### Top Kudos Contributor

####
* Trending Programming Qs.*

- Write a program to merge two sorted array.
- Write a program to accept two time stamps in the given format HH:MM:SS...
- Write a program to reverse the string?
- Given an array Arr[ ] of N integers and a positive integer K. The task...
- Write a program to convert uppercase to lower case and vice versa of a...
- Given a string, say sentence=" this is crazy and fun" and a list, say ...

####
* Last Month Contributor*

- Write a program to count the no. of words in the given string?
- Write a program to print next to the last word of a sentence.
- Write a program to convert uppercase to lower case and vice versa of a...
- Given a string, say sentence=" this is crazy and fun" and a list, say ...
- Write a program to reverse the string?