Tata Communications Coding Questions and Answers

Coding Questions in TATA Communications

TATA Communications Coding Questions page will help you get all the Coding Questions with Solutions, asked in Online Assessments and Technical Interviews included in Company’s Hiring Process.

Apart from that you will get Steps in the Hiring Process, Eligibility Criteria, and Skills required for a particular Job Profile.

TATA Communications Coding Questions

About TATA Communications

The fast-expanding digital economy is powered by Tata Communications, a facilitator of the digital ecosystem. We assist businesses all around the world, including 300 Fortune 500 companies, in undergoing digital transformation. We transport about 30% of the internet routes in the world and link companies to 60% of the largest cloud providers.

We have been a part of the rich tradition of the internet in India. Enterprise-enabled services have been crucial to the uptake of digital services in the nation during the past 25 years. Connectivity is a crucial component of the economic support system.

TATA Communications Recruitment Process

TATA Communications is hiring or the position of Engineer – Product Management (Core and Next-Gen Connectivity Services).

  • Assessment (Online)
  • Pre-Placement Talk
  • Interview

TATA Communication Eligibility Criteria

  • Engineering (Undergraduate) – 60% and Above.
  • No Active Backlogs & Drop
  • 10th & 12th – 65% and above
  • Eligible Branches – CS/IT/ECE

Other Required Skills for Tata Communications

  • Understanding of latest communication technologies
  • Inclination to understand technology evolution and regulatory framework
  • Ability to build consensus among diverse teams without formal authority
  • Ability to deal with ambiguity
  • Excellent verbal and written communication skills Creativity, flexibility, and openness to
    alternative approaches
  • Ability to work independently and manage multiple task assignments.
  • Strong problem solving & troubleshooting skills with the ability to exercise mature judgment.
  • Passion for software development and technology.

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Practice TATA Communications Coding Questions

Question 1 : Collecting Candies

Problem Description

Question:- Krishna loves candies a lot, so whenever he gets them, he stores them so that he can eat them later whenever he wants to.

He has recently received N boxes of candies each containing Ci candies where Ci represents the total number of candies in the ith box. Krishna wants to store them in a single box. The only constraint is that he can choose any two boxes and store their joint contents in an empty box only. Assume that there are an infinite number of empty boxes available.

At a time he can pick up any two boxes for transferring and if both the boxes contain X and Y number of candies respectively, then it takes him exactly X+Y seconds of time. As he is too eager to collect all of them he has approached you to tell him the minimum time in which all the candies can be collected.

Input Format:

  • The first line of input is the number of test case T
  • Each test case is comprised of two inputs
  • The first input of a test case is the number of boxes N
  • The second input is N integers delimited by whitespace denoting the number of candies in each box

Output Format: Print minimum time required, in seconds, for each of the test cases. Print each output on a new line.

Constraints:

  • 1 < T < 10
  • 1 < N< 10000
  • 1 < [Candies in each box] < 100009
S. No.InputOutput
11
4
1 2 3 4
19
21
5
1 2 3 4 5
34

Explanation for sample input-output 1:

4 boxes, each containing 1, 2, 3 and 4 candies respectively.Adding 1 + 2 in a new box takes 3 seconds.Adding 3 + 3 in a new box takes 6 seconds.Adding 4 + 6 in a new box takes 10 seconds.Hence total time taken is 19 seconds. There could be other combinations also, but overall time does not go below 19 seconds.

Explanation for sample input-output 2:

5 boxes, each containing 1, 2, 3, 4 and 5 candies respectively.Adding 1 + 2 in a new box takes 3 seconds.Adding 3 + 3 in a new box takes 6 seconds.Adding 4 + 6 in a new box takes 10 seconds.Adding 5 + 10 in a new box takes 15 seconds.Hence total time taken is 34 seconds. There could be other combinations also, but overall time does not go below 33 seconds.

Question 2 :

You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the largest of the numbers that have length m and sum of digits s. The required numbers should be non-negative integers written in the decimal base without leading zeroes.

Input

  • The single line of the input contains a pair of integers m, s (1 ≤ m ≤ 100, 0 ≤ s ≤ 900) — the length and the sum of the digits of the required numbers.

Output

  • In the output print the pair of the required non-negative integer numbers — first the minimum possible number, then — the maximum possible number. If no numbers satisfying conditions required exist, print the pair of numbers “-1 -1” (without the quotes).

Examples

  • Input 1
    2 15
  • Output 1
    69 96
  • Input 2
    3 0
  • Output 2
    -1 -1

Question 3: Amusement park

Problem Statement – Akshay loves to go to WONDERLA , an amusement park. They are offering students who can code well with some discount. Our task is to reduce the cost of the ticket as low as possible.

The cost of tickets can be removed by removing the digits from the price given. They will give some k turns to remove the digits from the price of the ticket. Your task is to help Akshay in coding a program that can help him to reduce the cost of a ticket by removing the digits from its price and getting the maximum possible discount.

Note – You cannot make the cost of a ticket zero. For eg -: If the cost of a ticket is 100, and you have 2 turns to reduce the price, the final price will be 1 and not zero.

Constraints:

  • 1 <= number of tickets <= 10^5
  • 1 <= K < Number of digits in Price of ticket

Input Format for Custom Testing:

  • The first line contains a string,Tickets, denoting the given cost of each ticket.
  • The next line contains an integer, K, denoting the number of tickets that is to be removed.

Sample Cases:

  • Sample Input 1
    203
    2
  • Sample Output 1
    0

Question 4 

A taxi can take multiple passengers to the railway station at the same time.On the way back to the starting point,the taxi driver may pick up additional passengers for his next trip to the airport.A map of passenger location has been created,represented as a square matrix.

The Matrix is filled with cells,and each cell will have an initial value as follows:

  • A value greater than or equal to zero represents a path.
  • A value equal to 1 represents a passenger.
  • A value equal to -1 represents an obstruction.

The rules of motion of taxi are as follows:

  • The Taxi driver starts at (0,0) and the railway station is at (n-1,n-1).Movement towards the railway station is right or down,through valid path cells.
  • After reaching (n-1,n-1) the taxi driver travels back to (0,0) by travelling left or up through valid path cells.
  • When passing through a path cell containing a passenger,the passenger is picked up.once the rider is picked up the cell becomes an empty path cell. 
  • If there is no valid path between (0,0) and (n-1,n-1),then no passenger can be picked.
  • The goal is to collect as many passengers as possible so that the driver can maximize his earnings.

For example consider the following grid,

           0      1
          -1     0

Start at top left corner.Move right one collecting a passenger. Move down one to the destination.Cell (1,0) is blocked,So the return path is the reverse of the path to the airport.All Paths have been explored and one passenger is collected.

Returns:

  • Int:maximum number of passengers that can be collected.

Sample Input 0

  • 4  -> size n = 4
  • 4 -> size m = 4
  • 0 0 0 1 -> mat
  • 1 0 0 0
  • 0 0 0 0
  • 0 0 0 0

Output 0

  • 2

Explanation 0

The driver can contain a maximum of 2 passengers by taking the following path
(0,0) → (0,1) → (0,2) → (0,3) → (1,3) → (2,3) → (3,3) → (3,2) → (3,1) → (3,0) → (2,0) → (1,0)  → (0,0)

Sample Input 1

 STD IN                  Function 

————              ————-

  •    3     →  size  n=3
  •    3    →  size m=3
  •    0 1 -1 → mat 
  •    1 0 -1
  •    1 1 1

Sample Output 1

  • 5

Explanation 1

The driver can contain a maximum of 5 passengers by taking the following path
(0,0) → (0,1) → (1,1) → (2,1) → (2,2) → (2,1) → (2,0) → (1,0) → (0,0) 

Question 5: Square Free Numbers Problem

Problem Description

In the theory of numbers, square free numbers have a special place.  A square free number is one that is not divisible by a perfect square (other than 1).  Thus 72 is divisible by 36 (a perfect square), and is not a square free number, but 70 has factors 1, 2, 5, 7, 10, 14, 35 and 70.  As none of these are perfect squares (other than 1), 70 is a square free number.

For some algorithms, it is important to find out the square free numbers that divide a number.  Note that 1 is not considered a square free number. 

In this problem, you are asked to write a program to find the number of square free numbers that divide a given number.

Input:-

  • The only line of the input is a single integer N which is divisible by no prime number larger than 19.

Output:-

  • One line containing an integer that gives the number of square free numbers (not including 1).

Constraints:-

  • N   < 10^9

Complexity:-

  • Simple

Time Limit:-

  • 1

Examples


Example 1

  • Input:-
    20
  • Output:-
    3

Explanation

N=20

If we list the numbers that divide 20, they are

1, 2, 4, 5, 10, 20

1 is not a square free number, 4 is a perfect square, and 20 is divisible by 4, a perfect square.  2 and 5, being prime, are square free, and 10 is divisible by 1,2,5 and 10, none of which are perfect squares.  Hence the square free numbers that divide 20 are 2, 5, 10.  Hence the result is 3.

Example 2

  • Input:-
    72
  • Output:-
    3

Explanation

N=72.  The numbers that divide 72 are

1, 2, 3, 4, 6, 8, 9, 12, 18, 24, 36, 72

1 is not considered square free.   4, 9 and 36 are perfect squares, and 8,12,18,24 and 72 are divisible by one of the.  Hence only 2, 3 and 6 are square free.  (It is easily seen that none of them are divisible by a perfect square).  The result is 3.

FAQs on Tata Communications Coding Questions

Question 1: Are there any coding questions asked in Tata Communications?

Yes, for technical profiles in Tata Communications coding questions are asked. On this page, we have provided all the Tata Commuications Coding Questions.

Question 2: Is Tata Communications exam difficult to crack?

The Tata Communications Coding Assessment is somewhat challenging. They focus on the candidate’s capacity for critical thinking and problem-solving ability.

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription