Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
11 views5 pages

TCS CodingLiveSession3

The document presents multiple coding problems, including printing elements of a 2D matrix in spiral format, counting integers with no repeated digits within a range, rearranging an array to move multiples of 10 to the end while maintaining order, and calculating travel costs based on hourly rates. Each problem includes example inputs and outputs to illustrate the expected results. The document serves as a resource for coding practice and algorithm development.

Uploaded by

anushkarokade21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

TCS CodingLiveSession3

The document presents multiple coding problems, including printing elements of a 2D matrix in spiral format, counting integers with no repeated digits within a range, rearranging an array to move multiples of 10 to the end while maintaining order, and calculating travel costs based on hourly rates. Each problem includes example inputs and outputs to illustrate the expected results. The document serves as a resource for coding practice and algorithm development.

Uploaded by

anushkarokade21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

TCS Coding Questions

Problem Statement:

Input 2D Matrix and print all the elements in spiral format.

1 2 3

4 5 6

7 8 9

Output: 1 2 3 6 9 8 7 4 5

This video is sole property of Talent Battle Pvt. Ltd. Strict penal action will be taken against unauthorized piracy of this video
Given two non-negative integers n1 and n2, where n1<n2.
The task is to find the total number of integers in the range [n1, n2](both inclusive) which have no repeated digits.

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.

Example1:
Input:
11 --- Value of n1
15 -- value of n2

Output:
4

Example 2:
Input:
101 -- value of n1
200 -- value of n2

Output:
72
Problem Statement:

Given an array Arr[ ] of N integer numbers. The task is to rewrite the array by putting all multipliers at the end of the
given array.

Note : The order of the numbers which are not the multiplier of 10 should remain unaltered ,and similarly the order of
the numbers which are the multiplier of 10 should remain unaltered.

For example :
Suppose N = 9 and Arr[] = {10, 12, 5, 40, 30, 7, 5, 9, 10}
You have to push all the multiple of 10 at the end of the array Arr[].
Hence the output is : 12 5 7 5 9 10 40 30 10

Test Case:
N=9
100 21 5 6 3 7 11 89 10

Output:
21 5 6 3 7 11 89 100 10
Problem Statement:

For hiring a car, a travel agency charges R1 rupees per hour for the first N hours and then R2 rupees per hour.
Given the total time of travel in minutes in X.
The task is to find the total travelling cost in rupees.
Note : While converting minutes into hours, ceiling value should be considered as the total number of hours.
For example : If the total travelling time is 90 minutes, i.e. 1.5 hours, it must be considered as 2 hours.

Example : Test Case:


Input : Input :
20 -- r1 30
4 -- n 5
40 -- r2 35
300 – x 500

Output : Output:
120 290

You might also like