- Prepare
- All Platforms
- Programming
- Aptitude
- Syllabus
- Interview Preparation
- Interview Exp.
- Off Campus
- Prime Video
- Prime Mock
- Prime Video
- OffCampus Updates
- Placement Stats
- Prime Video
- Prime Mock
- ^{0}
Notifications Mark All Read
No New notification
- Login
- Get Prime
TCS Ninja Coding Questions and Answers 2023
TCS Ninja Coding Questions and Answers 2023
TCS Ninja coding questions answers 2023 is available here. TCS Ninja coding questions paper with solutions is very important for TCS ninja exam. Also, you will find TCS ninja coding questions with solved papers. On PrepInsta you will find the Accurate TCS Ninja coding exam Pattern 2023.
- No Of Questions:- 2 Question
- Time – 45 mins
TCS Ninja Coding Questions With Solutions
TCS Coding Question Day 1 Slot 1 – Question 1
Mike has arranged a small party for the inauguration of his new startup. He has invited all of his fellow employees who are N in number. These employees are indexed with an array starting from 1 to N. In this startup, everyone knows each other’s salary. We will represent salary by an integer value. Mike has to arrange tables, where he will accommodate everyone. But he is a little thrifty in that, he wants to adjust everyone in as few tables as he can. Tables of various seating are available. Let’s say the cost of renting each table is K. All the employees have to seat in the order of the index. The only problem is that the employees with the same salary can get into arguments which can ruin the party.
Mike came across the term inefficiency of arrangement, which can be defined as the sum of the cost of tables + the total number of people getting into arguments. Given the number of employees, N, and their salaries in array a[ ], he wants to find the optimal inefficiency, i.e., the smallest possible value for the inefficiency of arranging the N employees.
Let’s understand it with an example.
Number of employees invited N = 5
A a = {5 1 3 3 3}
K = 1
Now let’s check all the combinations and how in-efficient is all of them.
When we make 1st, 2nd, and 3rd employee on table-1 and 4th and 5th on table-2
Cost of 2 tables = 2*1
Number of people getting into arguments = 2 (two 3’s: 4th and 5th employee)
Total = 2 + 2 = 4
When we make 1st, 2nd, 3rd, and 4th employees on table-1 and 5th on table-2
Cost of 2 tables = 2*1
Number of people getting into arguments = 2 (two 3’s: 4th and 5th employee)
Total = 2 + 2 = 4
When we make all of them sit at 1 table, then inefficiency will be
Cost of 1 table = 1
Number of people getting into arguments = 3 (all 3’s: 3rd, 4th and 5th employee)
Total = 1 + 3 = 4
When we make 1st, 2nd and 3rd employee on table-1 and 4th on table-2 and 5th on table-3
Cost of 3 tables = 3*1
Number of people getting into arguments = 0 (all 3’s are. sitting at different tables)
Total = 3 + 0 = 3
Hence the optimal in-efficiency is 3.
So, the output will be 3.
Example 1:
- Input:
5 1 -> Input Integer, N and K
{5, 1, 3, 3, 3) Input Integer, array elements a[i]. - Output:
3 -> Output - Explanation:
Below is the seating for each case:
Case 1:
Table 1: 1st, 2nd, and 3rd
Table 2: 4th and 5th
Number of people getting into arguments: 2
Total in-efficiency: 2*1 + 2 = 4
Case 2:
Table 1: 1st, 2nd, 3rd, and 4th
Table 2: 5th
Number of people getting into arguments: 2
Total in-efficiency: 2*1 + 2 = 4
Case 3:
Table 1: 1st, 2nd, 3rd, 4th, and 5th
Number of people getting into arguments: 3
Total in-efficiency: 1*1 + 3 = 4
Case 4:
Table 1: 1st, 2nd, and 3rd
Table 2: 4th
Table 3: 5th
Number of people getting into arguments: 0
Total in-efficiency: 3*1 + 0 = 3
Choosing the minimum which is 3.
So, the answer is 3.
Example 2:
- Input:
5 14 -> Input Integer, N and K.
{1, 4, 2, 4, 4} -> Input Integer, array elements a[i]. - Output:
17 -> Output - Explanation:
Below is the seating for each case:
Case 1:
Table 1: 1st, 2nd, and 3rd
Table 2: 4th and 5th
Number of people getting into arguments: 2
Total in-efficiency: 2*14 + 2 = 30
Case 2:
Table 1: 1st, 2nd, 3rd, and 4th
Table 2: 5th
Number of people getting into arguments: 2
Total in-efficiency: 2*14 + 2 = 30
Case 3:
Table 1: 1st, 2nd, 3rd, 4th, and 5th
Number of people getting into arguments: 3
Total in-efficiency: 1*14+3 = 17
Case 4:
Table 1: 1st, 2nd, and 3rd
Table 2: 4th
Table 3: 5th
Number of people getting into arguments: 3
Total in-efficiency: 3*14+ 0 = 42
Chose the minimum which is 17.
So, the answer is 17.
n, k = map(int, input().split()) arr = list(map(int, input().split())) print(min((n - len(set(arr)) + 1) * k, k + (n - len(set(arr)) + 1)))
#include <iostream> #include <vector> #include <algorithm> #include <climits> // Added header for INT_MAX using namespace std; int calculateInefficiency(const vector& salaries, int numTables, int tableCost) { int inefficiency = 0; int argumentsCount = 0; for (int i = 0; i < numTables; i++) { int tableArguments = 0; vector<int> tableEmployees; // Get the employees sitting at the current table for (int j = i; j < salaries.size(); j += numTables) { tableEmployees.push_back(salaries[j]); } // Count the number of arguments at the current table sort(tableEmployees.begin(), tableEmployees.end()); for (int j = 1; j < tableEmployees.size(); j++) { if (tableEmployees[j] == tableEmployees[j - 1]) { tableArguments++; } } inefficiency += tableCost + tableArguments; argumentsCount = max(argumentsCount, tableArguments); } inefficiency -= argumentsCount; return inefficiency; } int findOptimalInefficiency(const vector & salaries, int numTables, int tableCost) { int minInefficiency = INT_MAX; // Generate all possible combinations of tables for (int i = 1; i <= numTables; i++) { int inefficiency = calculateInefficiency(salaries, i, tableCost); minInefficiency = min(minInefficiency, inefficiency); } return minInefficiency; } int main() { int N, K; cout << "Enter the number of employees: "; cin >> N; vector salaries(N); cout << "Enter the salaries of employees: "; for (int i = 0; i < N; i++) { cin >> salaries[i]; } cout << "Enter the cost of renting each table: "; cin >> K; int optimalInefficiency = findOptimalInefficiency(salaries, N, K); cout << "The optimal inefficiency is: " << optimalInefficiency << endl; return 0; }
import java.util.*; public class Main { public static int calculateInefficiency(int[] salaries, int numTables, int tableCost) { int inefficiency = 0; int argumentsCount = 0; for (int i = 0; i < numTables; i++) { int tableArguments = 0; ListtableEmployees = new ArrayList<>(); // Get the employees sitting at the current table for (int j = i; j < salaries.length; j += numTables) { tableEmployees.add(salaries[j]); } // Count the number of arguments at the current table Collections.sort(tableEmployees); for (int j = 1; j < tableEmployees.size(); j++) { if (tableEmployees.get(j).equals(tableEmployees.get(j - 1))) { tableArguments++; } } inefficiency += tableCost + tableArguments; argumentsCount = Math.max(argumentsCount, tableArguments); } inefficiency -= argumentsCount; return inefficiency; } public static int findOptimalInefficiency(int[] salaries, int numTables, int tableCost) { int minInefficiency = Integer.MAX_VALUE; // Generate all possible combinations of tables for (int i = 1; i <= numTables; i++) { int inefficiency = calculateInefficiency(salaries, i, tableCost); minInefficiency = Math.min(minInefficiency, inefficiency); } return minInefficiency; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter the number of employees: "); int N = scanner.nextInt(); int[] salaries = new int[N]; System.out.print("Enter the salaries of employees: "); for (int i = 0; i < N; i++) { salaries[i] = scanner.nextInt(); } System.out.print("Enter the cost of renting each table: "); int K = scanner.nextInt(); int optimalInefficiency = findOptimalInefficiency(salaries, N, K); System.out.println("The optimal inefficiency is: " + optimalInefficiency); } }
TCS Coding Question Day 1 Slot 1 – Question 2
Jack and Jill are playing a string game. Jack has given Jill two strings A and B. Jill has to derive a string C from A, by deleting elements from string A, such that string C does not contain any element of string B. Jill needs help to do this task. She wants a program to do this as she is lazy. Given strings A and B as input, give string C as Output.
Example 1:
- Input:
tiger -> input string A
ti -> input string B - Output:
ger -> Output string C - Explanation:
After removing “t” and “i” from “tiger”, we are left with “ger”.
So, the answer is “ger”.
Example 2:
- Input:
processed -> input string A
esd -> input string B - Output:
proc -> Output string C - Explanation:
After removing “e” “s” and “d” from “processed”, we are left with “proc”.
So, the answer is “proc”.
Example 3:
- Input:
talent -> input string A
tens -> input string B - Output:
al -> Output string C
Explanation:
After removing “t” “e” and “n” from “talent”, we are left with “al”.
So, the answer is “al”.
a = input() b = input() c = "" for i in a: if i in b: continue else: c += i print(c)
import java.util.Scanner; public class Main { public static String deriveStringC(String A, String B) { StringBuilder result = new StringBuilder(); for (int i = 0; i < A.length(); i++) { char currentChar = A.charAt(i); if (B.indexOf(currentChar) == -1) { result.append(currentChar); } } return result.toString(); } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter string A: "); String A = scanner.nextLine(); System.out.print("Enter string B: "); String B = scanner.nextLine(); String C = deriveStringC(A, B); System.out.println("Output string C: " + C); } }
#include <iostream> #include <vector> std::string deriveStringC(const std::string& A, const std::string& B) { std::string result; for (char c : A) { if (B.find(c) == std::string::npos) { result += c; } } return result; } int main() { std::string A, B; std::cout << "Enter string A: "; std::getline(std::cin, A); std::cout << "Enter string B: "; std::getline(std::cin, B); std::string C = deriveStringC(A, B); std::cout << "Output string C: " << C << std::endl; return 0; }
TCS Coding Question Day 1 Slot 2 – Question 1
Mahesh and Suresh are playing a new game “Checkers“. This is a very simple game but becomes challenging when more expert players are playing. Below is the description of the game and rules: The game is played by 2 players. This game consists of an N*M matrix. Each of the cells is background lit by lights. And these cells are either Green or Black. The green and black cells are randomly lit and will be represented with 1’s and 0’s respectively. Green cells are the cells that need to be captured. Black cells cannot be captured. Everyone is in the race to capture the maximum number of cells possible.
In a single chance, a player can capture all those adjacent cells which share an edge. Once there is no adjacent edge the chance breaks and the next player will play.
Mahesh always starts the game and Suresh is second.
Both players are playing optimally, find out how many cells Suresh captures.
Input:
N and M, size of the matrix
A[i][j] for all 1<=i<=N and 1<=j<=M
Let us try to understand it with an example
Consider the matrix below
N = 4
M = 4
A = 1001
0110
0110
1001
If Mahesh plays first, he will try to capture most of the 1’s, he will capture A[2][2], A[2][3], A[3][2], and A[3][3]. Now there are no adjacent cells left. So, the chance will be given to Suresh. Now Suresh’s turn. He can capture either A[1][1] or A[4][1] or A[4][7] or A[4][4]. He will capture any one cell, and as there is no adjacent deft, the chance will now be given to Mahesh. The game proceeds and then again Suresh’s turn will come, and he will again be able to choose only 1 cell finally Mahesh will end the game by choosing the final cell.
Like this Mahesh has captured 6 cells and Suresh has captured only 2 cells.
Hence 2 is the answer.
Example 1:
- Input:
2 2 -> Input integer, N, M
1 1 -> Input integer, A[i]
1 1 -> Input integer, A[N] - Output:
0 -> Output - Explanation:
In the above scenario, it is very clear that if Mahesh plays first, he will capture all the cells as all the cells are adjacent to each other.
There will be nothing left for Suresh. Hence the cells captured by Suresh will be 0.
Hence the answer is 0.
Example 2:
- Input:
4 4 -> Input integer, N, M
1001 -> Input integer, A[i]
0110 -> Input integer, A[i+1]
0110 -> Input integer, A[i+2]
1001 -> Input integer, A[N] - Output:
2 -> Output - Explanation:
If Mahesh plays first, he will try to cover most of the 1’s, he will cover A[2][2], A[2][3], A[3][2], and A[3][3]. Now there are no adjacent cells left. So, the chance will be given to Suresh. Now Suresh’s turn. He can capture either of A[1][1] or A[4][1] or A[4][1] or A[4][4]. He will capture any one cell, and as there is no adjacent left, the chance will now be given to Mahesh. The game proceeds and then again Suresh’s turn will come, and he will again be able to choose only 1 cell, and finally, Mahesh will end the game by choosing the final cell.
Like this Mahesh has captured 6 cells and Suresh has captured only 2 cells.
Hence 2 is the answer.
#include<bits/stdc++.h> using namespace std; int main() { int n,m; cin >> n >> m; int a[n][m]; int count = 0; for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { cin >> a[i][j]; } } for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ if(a[i][j] == a[i+1][j]) continue; else { if(a[i+1][j] == 1 && (a[i+2][j] == 1)) count++; } } } cout << count << "\n"; return 0; }
n, m = map(int, input().split()) a = [] for i in range(n): a.append(list(map(int, input().split()))) ans = 0 for i in range(n-2): for j in range(m): if a[i][j] == a[i + 1][j]: continue elif a[i + 1][j] == 1 and a[i + 2][j] == 1: ans += 1 print(ans)
import java.util.Scanner; public class Main { static int[][] directions = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; public static void captureCells(int[][] A, boolean[][] visited, int player, int row, int col, int[] sureshCaptured) { int N = A.length; int M = A[0].length; if (row < 0 || row >= N || col < 0 || col >= M || visited[row][col]) { return; } visited[row][col] = true; if (player == 2) { sureshCaptured[0]++; } for (int[] dir : directions) { int newRow = row + dir[0]; int newCol = col + dir[1]; captureCells(A, visited, 3 - player, newRow, newCol, sureshCaptured); } } public static int countSureshCapturedCells(int[][] A) { int N = A.length; int M = A[0].length; int[] sureshCaptured = {0}; boolean[][] visited = new boolean[N][M]; for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { if (!visited[i][j]) { captureCells(A, visited, 1, i, j, sureshCaptured); } } } return sureshCaptured[0]; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter the size of the matrix (N M): "); int N = scanner.nextInt(); int M = scanner.nextInt(); int[][] A = new int[N][M]; System.out.println("Enter the matrix elements:"); for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { A[i][j] = scanner.nextInt(); } } int sureshCaptured = countSureshCapturedCells(A); System.out.println("The number of cells captured by Suresh: " + sureshCaptured); } }
TCS Coding Question Day 1 Slot 2 – Question 2
Joe was reading an interesting novel when all of a sudden, his 5-year-old son came to him and started asking a few questions about functions. He tried making him understand various functions, but his son didn’t get find it interesting. Then he created his function Absent number function A(S) According to this function, there is always the smallest positive integer number in a sequence that is not available. In simple words, if you sort the given sequence, then the smallest integer number (other than 0) which is not present in the sequence is the Absent number. Consider a sequence S= [1, 2, 3], then B(S)=4. The minimum value greater than 0 which is not present here in the sequence is 4. Now his son found it interesting, so Joe extended this logic to sub-sequence. If there is a given sequence S, you have to find the Absent Number for each sub-sequence and then sum it up. If the answer is large, print the result modulo, 109 +7.
Let say there exist a sequence with N = 3, and sequence S = [1, 2, 1]
Below are the various sub-sequences of it,
It will be 2N:
[ ] : B([ ]) = 1
[1] : B([1]) = 2
[2] : B([2]) = 1
[1] : B([1]) = 2
[1, 2] : B([1, 2]) = 3
[2, 1] : B([2, 1]) = 3
[1, 1] : B([1, 1]) = 2
[1, 2, 1] : B([1, 2, 1]) = 3
Total sum of all B(S) = 1+2+1+2+3+3+2+3 = 17.
Hence the answer is 17.
Example 1:
- Input:
2 -> input Integer, N
1 1 -> input Integer, S - Output:
7 -> Output - Explanation:
In the above scenario below are the various sub-sequence and their respective functions of it:
[ ] : B(l) = 1
[1]: B([1])= 2
[1]: B([1]) = 2
[1,1]: B([1,1]) = 2
Total sum of all B(S) = 1+2+2+2 = 7 Hence the answer is 7.
Example 2:
- Input:
3 -> Input integer, N
1 2 1 -> Input integer, S - Output:
17->Output - Explanation:
In the above scenario below are the various sub-sequences and their respective functions of it.
[ ] : B([ ]) = 1
[1] : B([1]) = 2
[2] : B([2]) =1
[1] : B([1]) = 2
[1, 2] : B([1, 2]) = 3
[2, 1] : B([2, 1]) = 3
[1, 1] : B([1, 1]) = 2
[1, 2, 1] : B([1, 2, 1]) = 3
Total sum of all B(S) = 1 + 2 + 1 + 2 + 3 + 3 + 2 + 3 = 17.
Hence the answer is 17.
from itertools import combinations def fun(n, s): ans = 1 comb = [] for i in range(n): comb += combinations(s, i + 1) for i in comb: a = minMis(list(i)) ans += a return ans def minMis(arr): for i in range(len(arr)): if i + 1 not in arr: return i + 1 return len(arr) + 1 n = int(input()) s = list(map(int, input().split())) print(fun(n, s))
import java.util.Arrays; import java.util.Scanner; public class Main { static final int MOD = (int) (1e9 + 7); public static int absentNumber(int[] subsequence) { Arrays.sort(subsequence); int n = subsequence.length; int missing = 1; for (int i = 0; i < n; i++) { if (subsequence[i] == missing) { missing++; } } return missing; } public static int sumOfAbsentNumbers(int[] sequence) { int n = sequence.length; int sum = 0; for (int i = 0; i < (1 << n); i++) { int subsequenceSize = Integer.bitCount(i); int[] subsequence = new int[subsequenceSize]; int index = 0; for (int j = 0; j < n; j++) { if ((i & (1 << j)) != 0) { subsequence[index++] = sequence[j]; } } sum = (sum + absentNumber(subsequence)) % MOD; } return sum; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter the size of the sequence (N): "); int N = scanner.nextInt(); int[] sequence = new int[N]; System.out.print("Enter the sequence elements: "); for (int i = 0; i < N; i++) { sequence[i] = scanner.nextInt(); } int sum = sumOfAbsentNumbers(sequence); System.out.println("The sum of all Absent Numbers: " + sum); } }
#include <iostream> #include <vector> #include <algorithm> using namespace std; const int MOD = 1e9 + 7; int absentNumber(const vector& subsequence) { vector sortedSubsequence = subsequence; sort(sortedSubsequence.begin(), sortedSubsequence.end()); int missing = 1; for (int num : sortedSubsequence) { if (num == missing) { missing++; } } return missing; } int sumOfAbsentNumbers(const vector & sequence) { int n = sequence.size(); int sum = 0; for (int i = 0; i < (1 << n); i++) { vector subsequence; for (int j = 0; j < n; j++) { if ((i & (1 << j)) != 0) { subsequence.push_back(sequence[j]); } } sum = (sum + absentNumber(subsequence)) % MOD; } return sum; } int main() { int N; cout << "Enter the size of the sequence (N): "; cin >> N; vector<int> sequence(N); cout << "Enter the sequence elements: "; for (int i = 0; i < N; i++) { cin >> sequence[i]; } int sum = sumOfAbsentNumbers(sequence); cout << "The sum of all Absent Numbers: " << sum << endl; return 0; }
TCS Coding Question Day 2 Slot 1 – Question 1
James has a sequence of N numbers. There is also an integer X which is a random number from other sources. He is allowed to perform a specific operation on this sequence X number of times. Below is the operation:
- Pick exactly one element from the sequence and multiply it with -1.
Your task is to find out the number of different sequences which can be formed by performing the above operation. If the answer is large, print the result modulo 109 +7.
Let us try to understand it with an example,
N = 3
X = 2
S = [1, 2, 3]
There are 2 ways in which this operation can be performed.
- Way 1: Either -1 should be multiplied to the same element 2 times, OR
- Way 2: -1. Should be multiplied by two different elements once each.
Way 1:
If we multiply -1, to each element 2 times. It will become +1 (-1 *-1).
We will get the same sequence for each element:
- Multiply -1, 2 times to S[1] : [1, 2, 3].
- Multiply -1, 2 times to S[2] : [1, 2, 3].
- Multiply -1, 2 times to S[3] : [1, 2, 3].
So, the unique sequence is just 1 which is [1, 2, 3].
Way 2:
If we multiply -1, by two different elements just 1 time each. We get:
- Multiply -1 to S[1] & S[2] : [-1, -2, 3].
- Multiply -1 to S[2] & S[3] : [1, -2, -3].
- Multiply -1 to S[1] & S[3] : [-1, 2, -3].
Hence, we get a total of 3 different sequences from Way 2.
Total 1 + 3 = 4 different sequences.
Hence the answer is 4.000
Example 1:
- Input:
3 1 -> Input integer, N, X
{1, 2, 1} -> Input integer, S - Output:
3 -> Output - Explanation:
In the given scenario, we have X =1. Hence, we can have this multiplication of -1 only once.
So, if we multiply -1, by different elements just 1 time. We get:- Multiply -1 to S[1] & S[2] : [-1, -2, 1].
- Multiply -1 to S[2] & S[3] : [1, -2, -1].
- Multiply -1 to S[1] & S[3] : [-1, 2, -1].
Hence, we get a total of 3 different sequences.
So, the answer is 3.
Example 2:
- Input:
3 2 -> Input integer, N, X
{1, 2, 3} -> Input integer, S - Output:
4 -> Output - Explanation:
There are 2 ways in which this operation can be performed- Way 1: Either – 1 should be multiplied to the same element 2 times, OR
- Way 2: -1 should be multiplied by different elements once.
As shown in the above Demo example, there will be a total of 4 different sequences which can be achieved from this.
Hence the answer is 4.
#include<bits/stdc++.h> using namespace std; int ct(int a[], int n) { unordered_set s; int res = 0; for (int i = 0; i < n; i++) { if (s.find(a[i]) == s.end()) { s.insert(a[i]); res++; } } return res; } int factorial(int n) { if(n == 0) return 1; int factorial = 1; for (int i = 2; i <= n; i++) factorial = factorial * i; return factorial; } int total_combination(int n, int x) { return factorial(n) / (factorial(x) * factorial(n - x)); } int main() { int n, x, ans, cnt = 0; cin >> n >> x; int a[n]; for(int i =0 ; i < n; i++) { cin >> a[i]; } int k = ct(a,n); if(x%2 == 0) { ans = 1; ans += total_combination(k,x); } else { ans = k-1; ans += total_combination(k,x); } cout << ans << "\n"; return 0; }
n, x = map(int, input().split()) arr = list(map(int, input().split())) ans = 0 for i in range(n - 1): for j in range(i + 1, n): ans += 1 if x % 2 == 0: ans += 1 print(ans)
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Main { static final int MOD = (int) (1e9 + 7); public static int countDifferentSequences(int N, int X, int[] sequence) { SetdistinctElements = new HashSet<>(); for (int num : sequence) { distinctElements.add(num); } int distinctCount = Math.min(distinctElements.size(), X); int result = powMod(2, distinctCount); return result; } public static int powMod(int base, int exponent) { int result = 1; while (exponent > 0) { if (exponent % 2 == 1) { result = (result * base) % MOD; } base = (base * base) % MOD; exponent /= 2; } return result; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter the size of the sequence (N): "); int N = scanner.nextInt(); System.out.print("Enter the number of times the operation can be performed (X): "); int X = scanner.nextInt(); int[] sequence = new int[N]; System.out.print("Enter the sequence elements: "); for (int i = 0; i < N; i++) { sequence[i] = scanner.nextInt(); } int count = countDifferentSequences(N, X, sequence); System.out.println("The number of different sequences: " + count); } }
TCS Coding Question Day 2 Slot 1 – Question 2
Two parallel roads separated by a river are connected from cities A and B to an outer ring road. Both roads have a high flow of traffic throughout the day. People who want to travel from city A to city B or vice versa have to pass through the ring road which is a huge waste of time and money. To ease the traffic and also to make it convenient for commuters to travel from city A to city B and vice versa, the construction of a bridge over the river is planned.
The surveillance team submitted a report stating the bridge should be constructed in the following manner:
- The ground or soil is stronger at certain points on the road favorable for the construction of the bridge.
- The strong ground positions are given from the starting point of each road. Say, the road of city A has strong ground at 1,4 meaning there is a strong ground at a distance of 1 unit, another strong ground point at a distance of 4 units from the starting point of the road of city A.
Collate the strong ground positions of both roads. Sort them in ascending order. Calculate the middle point or median of the combined strong ground positions. The bridge should be constructed from road A as per the middle point calculated. Given the number of strong positions on roads A and B(N1 and N2 respectively) and the strong ground positions on each road, the task here is to calculate the midpoint of the combined strong positions on both roads.
NOTE: When the strong positions are combined, the repeated positions on the different roads are dropped.
Example 1:
- Input:
3 -> Value of N1
3 -> Value of N2
{3,5,2} -> a[ ], Elements a[0]to a[N1-1], where each input element is separated by new line
{1,2,3} -> b[ ], Elements b[0]to b[N2-1), where each input element is separated by new line - Output: 2.5
- Explanation:
From the inputs given above:
Number of strong ground positions on road A:3
Number of strong ground positions on road B:3
The positions of strong ground from the starting point of road A are at a distance of 3,5,2
The positions of strong ground from the starting point of road B are at a distance of 1,2,3
Combining the strong ground positions of both the roads and sorting them in ascending order
1, 2, 3, 5
The Middle points are 2 and 3
2+3 = 5
5/2 = 2.5
So, the middle point from where the bridge should be constructed is 2.5.
Hence, the output is 2.5
Example 2:
- Input:
2 -> Value of N1
3 -> Value of N2
{2,3} -> all, Elements a[O]to a[N1-1), where each input element is separated by new line
{5,6,4} -> b[ ], Elements b[O]to b[N2-1], where each input element is separated by new line - Output: 4
- Explanation:
From the inputs given above:
Number of strong ground positions on road A: 2
Number of strong ground positions on road B: 3
The positions of strong ground from the starting point of road A are at a distance of 2, 3 The positions of strong ground from the starting point of road B are at a distance of 5, 6, and 4 Combining the strong ground positions of both the roads and sorting them in ascending order: 2, 3, 4, 5, 6 > Middle point is 4
So, the middle point from where the bridge should be constructed is 4.
Hence, the output is 4.
n1 = int(input()) n2 = int(input()) a = [] b = [] for i in range(n1): a.append(int(input())) for i in range(n2): b.append(int(input())) c = list(set(a + b)) c.sort() l = len(c) if l % 2 == 0: print((c[l // 2] + c[(l // 2) - 1]) / 2) else: print(c[l // 2])
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N1 = scanner.nextInt(); int N2 = scanner.nextInt(); Listarr1 = new ArrayList<>(); List arr2 = new ArrayList<>(); for (int i = 0; i < N1; i++) { arr1.add(scanner.nextInt()); } for (int i = 0; i < N2; i++) { arr2.add(scanner.nextInt()); } List combined = new ArrayList<>(); combined.addAll(arr1); combined.addAll(arr2); Collections.sort(combined); double midpoint; int size = combined.size(); if (size % 2 == 0) { midpoint = (combined.get(size/2 - 1) + combined.get(size/2)) / 2.0; } else { midpoint = combined.get(size/2); } System.out.println(midpoint); scanner.close(); } }
#include#include #include using namespace std; int main() { int N1, N2; cin >> N1 >> N2; vector arr1(N1), arr2(N2); for (int i = 0; i < N1; i++) { cin >> arr1[i]; } for (int i = 0; i < N2; i++) { cin >> arr2[i]; } vector combined; combined.insert(combined.end(), arr1.begin(), arr1.end()); combined.insert(combined.end(), arr2.begin(), arr2.end()); sort(combined.begin(), combined.end()); double midpoint; int size = combined.size(); if (size % 2 == 0) { midpoint = (combined[size/2 - 1] + combined[size/2]) / 2.0; } else { midpoint = combined[size/2]; } cout << midpoint << endl; return 0; }
TCS Coding Question Day 2 Slot 2 – Question 1
A chocolate factory is packing chocolates into packets. The chocolate packets here represent an array arrt of N number of integer values. The task is to find the empty packets(0) of chocolate and push it to the end of the conveyor belt(array).
For Example:
- N=7 and arr = [4,5,0,1.9,0,5,0].
- There are 3 empty packets in the given set. These 3 empty packets represented as O should be pushed towards the end of the array
Example 1:
Input:
- 7 – Value of N
- [4,5,0,1,0,0,5] – Element of arr[O] to arr[N-1],While input each element is separated by newline
Output:
- 4 5 1 9 5 0 0
Example 2:
Input:
- 6
- — Value of N.
- [6,0,1,8,0,2] – Element of arr[0] to arr[N-1], While input each element is separated by newline
Output:
- 6 1 8 2 0 0
#include <bits/stdc++.h> using namespace std; int main() { int n,j=0; cin>>n; int a[n]={0}; for(int i=0;i<n;i++) { cin>>a[j]; if(a[j]!=0) j++; } for(int i=0;i<n;i++) cout<<a[i]<<" "; }
import java.util.*; class Solution { public static void main (String[]args) { Scanner sc = new Scanner (System.in); int n = sc.nextInt (); int arr[] = new int[n]; for(int i = 0; i < n; i++) arr[i] = sc.nextInt (); int count = 0; for(int i = 0; i < n; i++) if (arr[i] != 0) arr[count++] = arr[i]; for(int i = count; i < n; i++) arr[i] = 0; for (int i = 0; i < n; i++) System.out.print (arr[i] + " "); } }
n=int(input()) j=0 L=[0 for i in range(n)] for i in range(n): a=int(input()) if a!=0: L[j]=a j+=1 for i in L: print(i,end=" ")
TCS Coding Question Day 2 Slot 2 – Question 2
Joseph is learning digital logic subject which will be for his next semester. He usually tries to solve unit assignment problems before the lecture. Today he got one tricky question. The problem statement is “A positive integer has been given as an input. Convert decimal value to binary representation. Toggle all bits of it after the most significant bit including the most significant bit. Print the positive integer value after toggling all bits”.
Constraints :
1<=N<=100
Example 1:
Input :
10 -> Integer
Output :
5 -> result- Integer
Explanation:
Binary representation of 10 is 1010. After toggling the bits(1010), will get 0101 which represents “5”. Hence output will print “5”.
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int k=(1<<(int)floor(log2(n))+1)-1; cout<<(n^k); }
import java.util.*; class Solution { public static void main (String[]args) { Scanner sc = new Scanner (System.in); int no = sc.nextInt (); String bin = ""; while (no != 0) { bin = (no & 1) + bin; no = no >> 1; } bin = bin.replaceAll ("1", "2"); bin = bin.replaceAll ("0", "1"); bin = bin.replaceAll ("2", "0"); int res = Integer.parseInt (bin, 2); System.out.println (res); } }
import math n=int(input()) k=(1<<int(math.log2(n))+1)-1 print(n^k)
TCS Coding Question Day 3 Slot 1 – Question 1
Airport security officials confiscated several items of the passengers at the security checkpoint. All the items have been dumped into a huge box (array). Each item possesses a certain amount of risk[0,1,2]. Here, the risk severity of the items represents an array[] of N number of integer values. The task here is to sort the items based on their levels of risk in the array. The risk values range from 0 to 2.
Example :
Input :
7 -> Value of N
[1,0,2,0,1,0,2]-> Element of arr[0] to arr[N-1], while input each element is separated by new line.
Output :
0 0 0 1 1 2 2 -> Element after sorting based on risk severity
Example 2:
input : 10 -> Value of N
[2,1,0,2,1,0,0,1,2,0] -> Element of arr[0] to arr[N-1], while input each element is separated by a new line.
Output :
0 0 0 0 1 1 1 2 2 2 ->Elements after sorting based on risk severity.
Explanation:
In the above example, the input is an array of size N consisting of only 0’s, 1’s, and 2s. The output is a sorted array from 0 to 2 based on risk severity.
Solution in Java:
import java.util.*;
class Solution
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int arr[]=new int[n];
for(int i=0;i<n;i++)
arr[i]=sc.nextInt();
int countZero=0,countOne=0,countTwo=0;
for(int i=0;i<n;i++)
{
if(arr[i]==0)
countZero++;
else if(arr[i]==1)
countOne++;
else if(arr[i]==2)
countTwo++;
}
int j=0;
while(countZero>0)
{
arr[j++]=0;
countZero--;
}
while(countOne>0)
{
arr[j++]=1;
countOne--;
}
while(countTwo>0)
{
arr[j++]=2;
countTwo--;
}
for(int i=0;i<n;i++)
System.out.print(arr[i]+" ");
}
}
#include <iostream> #include <vector> using namespace std; void sortArrayByRisk(vector<int>& arr) { int n = arr.size(); // Count the frequency of each risk severity level vectorfrequency(3, 0); for (int i = 0; i < n; i++) { frequency[arr[i]]++; } // Sort the array based on risk severity levels int index = 0; for (int i = 0; i < 3; i++) { while (frequency[i] > 0) { arr[index] = i; index++; frequency[i]--; } } } int main() { int n; cin >> n; vector<int> arr(n); for (int i = 0; i < n; i++) { cin >> arr[i]; } // Sort the array based on risk severity levels sortArrayByRisk(arr); // Print the sorted array for (int i = 0; i < n; i++) { cout << arr[i] << " "; } cout << endl; return 0; }
# Read the value of N from STDIN n = int(input()) # Read the elements of the array from STDIN arr = [] for _ in range(n): arr.append(int(input())) # Count the frequency of each risk severity level frequency = [0, 0, 0] for item in arr: frequency[item] += 1 # Sort the array based on risk severity levels sorted_arr = [] for i in range(3): sorted_arr.extend([i] * frequency[i]) # Print the sorted array to STDOUT for item in sorted_arr: print(item, end=" ")
TCS Coding Question Day 3 Slot 1 – Question 2
Given N gold wires, each wire has a length associated with it. At a time, only two adjacent small wires are assembled at the end of a large wire and the cost of forming is the sum of their length. Find the minimum cost when all wires are assembled to form a single wire.
For Example:
Suppose, Arr[]={7,6,8,6,1,1,}
{7,6,8,6,1,1}-{7,6,8,6,2} , cost =2
{7,6,8,6,2}- {7,6,8,8}, cost = 8
{7,6,8,8} – {13,8,8}, cost=13
{13,8,8} -{13,16}, cost=16
{13, 16} – {29}, cost =29
2+8+13+16+29=68
Hence , the minimum cost to assemble all gold wires is 68.
Constraints
- 1<=N<=30
- 1<= Arr[i]<=100
Example 1:
Input
6 -> Value of N, represent size of Arr
7 -> Value of Arr[0], represent length of 1st wire
6 -> Value of Arr[1], represent length of 2nd wire
8 -> Value of Arr[2] , represent length of 3rd wire
6 -> Value of Arr[3], represent length of 4th wire
1 -> Value of Arr[4], represent length of 5th wire
1 -> Value of Arr[5], represent length of 6th wire
Output :
68
Example 2:
Input
4 -> Value of N, represents size of Arr
12 -> Value of Arr[0], represents length of 1st wire
2 -> Value of Arr[1], represent length of 2nd wire
2 -> Value of Arr[2], represent length of 3rd wire
5 -> Value of Arr[3], represent length of 4th wire
Output :
34
import java.util.*;
class Solution
{
public static int solve (int arr[], int n)
{
PriorityQueue <Integer> queue = new PriorityQueue<Integer>();
for (int i = 0; i < n; i++)
queue.add (arr[i]);
int sum = 0, temp1, temp2;
while (queue.size () >= 2)
{
temp1 = queue.poll ();
temp2 = queue.poll ();
sum += temp1 + temp2;
queue.add (temp1 + temp2);
}
return sum;
}
public static void main (String[]args)
{
Scanner sc = new Scanner (System.in);
int n = sc.nextInt ();
int arr[] = new int[n];
for (int i = 0; i < n; i++)
arr[i] = sc.nextInt ();
System.out.println (solve (arr, n));
}
}
#include <iostream> #include <vector> #include <climits> using namespace std; int minimumCost(vector<int>& arr) { int n = arr.size(); vector<vector<int>> dp(n, vector<int>(n, 0)); // Iterate over different lengths of wires for (int len = 2; len <= n; len++) { for (int i = 0; i <= n - len; i++) { int j = i + len - 1; dp[i][j] = INT_MAX; // Try different partition points between i and j for (int k = i; k < j; k++) { int cost = dp[i][k] + dp[k + 1][j] + arr[i] + arr[k + 1]; dp[i][j] = min(dp[i][j], cost); } } } return dp[0][n - 1]; } int main() { int n; cin >> n; vector<int> arr(n); for (int i = 0; i < n; i++) { cin >> arr[i]; } // Find the minimum cost to assemble all gold wires int minCost = minimumCost(arr); // Print the minimum cost cout << minCost << endl; return 0; }
def minimum_cost(arr): n = len(arr) dp = [[0] * n for _ in range(n)] # Iterate over different lengths of wires for length in range(2, n + 1): for i in range(n - length + 1): j = i + length - 1 dp[i][j] = float('inf') # Try different partition points between i and j for k in range(i, j): cost = dp[i][k] + dp[k + 1][j] + arr[i] + arr[k + 1] dp[i][j] = min(dp[i][j], cost) return dp[0][n - 1] # Read the value of N from STDIN n = int(input()) # Read the lengths of wires from STDIN arr = [] for _ in range(n): arr.append(int(input())) # Find the minimum cost to assemble all gold wires min_cost = minimum_cost(arr) # Print the minimum cost to STDOUT print(min_cost)
TCS Coding Question Day 3 Slot 2 – Question 1
Given an array Arr[] of size T, contains binary digits, where
- 0 represents a biker running to the north.
- 1 represents a biker running to the south.
The task is to count crossing biker in such a way that each pair of crossing biker(N, S), where 0<=N<S<T, is passing when N is running to the north and S is running to the south.
Constraints:
0<=N<S<T
Example 1:
Input :
- 5 -> Number of elements i.e. T
- 0 -> Value of 1st element.
- 1 -> Value of 2nd element
- 0 -> Value of 3rd element.
- 1 -> Value of 4th element.
- 1 -> Value of 5th element
Output :
- 5
Explanation:
The 5 pairs are (Arr[0], Arr[1]), (Arr[0], Arr[3]), (Arr[0], Arr[4]), (Arr[2],Arr[3]) and (Arr[2], Arr[4]).
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int n, a, sum = 0, c = 0;
cin >> n;
for (int i = 0; i < n; i++){
cin >> a;
if (a)
sum += c;
else
c++;
}
cout << sum;
}
import java.util.*;
class Solution
{
public static void main (String[]args)
{
Scanner sc = new Scanner (System.in);
int a, sum = 0, c = 0;
int n = sc.nextInt ();
for (int i = 0; i < n; i++)
{
a = sc.nextInt ();
if (a != 0)
sum += c;
else
c++;
}
System.out.println (sum);
}
}
System.out.println (sum);
}
}
n = int (input ()) L =[] sum = 0 c = 0 for _ in range (n): a = (input ()) if a: sum += c else: c += 1 print (sum)
TCS Coding Question Day 3 Slot 2 – Question 2
Mr. Rao is relocating from place A to B. The moving truck has a maximum capacity C. There are ‘N’ items in the house where each item has a corresponding value (Vi) and weight(Wi). Mr. Rao has to carry only the most valuable items whose total weight does not exceed the capacity of truck. The task here is to find those items (single or combination of items) whose total value (v) will be the maximum and their corresponding weight(w) will not exceed truck capacity(c). Here,
- N= No. of items
- C= Maximum capacity of the truck, an integer value,
- W[0 to N-1]- An array consisting weight of each item
- V[0 to N-1] – An array consisting value of each item.
Example 1:
Input :
- 4 -> Value of N
- 80 -> Value of C
- [10,45,60,90] -> Elements of array v[], where each element is separated by new line.
- [15,20,30,40] -> Elements of array w[], where each element is separated by new line.
Output: 150
Explanation:
- Value=10 weight=15
- Value=45 weight = 20
- Value = 60 weight=30
- Value=90 weight=40
The subsets that can be formed from the array V[], their corresponding weight W[] and comparison with c=80
Value | Total Value | Weight | Total Weight | Valid (total weight(<C) Invalid (total weight>C) |
---|---|---|---|---|
10+45 | 55 | 15+20 | 35 | Valid |
10+60 | 70 | 15+30 | 45 | Valid |
10+90 | 100 | 15+40 | 55 | Valid |
45+60 | 105 | 20+30 | 50 | Valid |
45+90 | 135 | 20+40 | 60 | Valid |
60+90 | 150 | 20+40 | 70 | Valid |
10+45+60 | 115 | 20+40 | 65 | Valid |
10+60+90 | 160 | 20+40 | 85 | Invalid |
10+45+90 | 145 | 20+40 | 75 | Valid |
From the above table, it is perceived that particularly for the valid items, maximum value=150 and their corresponding weight is 70. So the output should be 150.
The input format for testing
First Input – Accept value for N (positive integer number).
Second input : Accept value for C (Positive integer number),
Third input – Accept N number of positive integer number for array v[0…N-1], where each value is separated by a new line.
Fourth input – Accept N positive integer numbers for array [0….N-1], where each value is separated by a new line.
The output format for testing
The output should be a positive integer number (Check the output in Example 1)
Constraints:
- 0<=N<=10
- 0 <= C<=500
- 1<=V[i]<=500
import java.util.*;
class Solution
{
public static int solve(int c,int w[],int val[],int n)
{
if(n==0 || c==0)
return 0;
if(c<w[n-1])
return solve(c,w,val,n-1);
else
return Math.max(solve(c,w,val,n-1),val[n-1]+solve(c-w[n-1],w,val,n-1));
}
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int c=sc.nextInt();
int v[]=new int[n];
int w[]=new int[n];
for(int i=0;i<n;i++)
v[i]=sc.nextInt();
for(int i=0;i<n;i++)
w[i]=sc.nextInt();
System.out.println(solve(c,w,v,n));
}
}
#include <iostream> #include <vector> using namespace std; int findMaximumValue(const vector& values, const vector & weights, int capacity, int n) { vector > dp(n + 1, vector (capacity + 1, 0)); for (int i = 1; i <= n; i++) { for (int w = 1; w <= capacity; w++) { if (weights[i - 1] <= w) { dp[i][w] = max(values[i - 1] + dp[i - 1][w - weights[i - 1]], dp[i - 1][w]); } else { dp[i][w] = dp[i - 1][w]; } } } return dp[n][capacity]; } int main() { int n, capacity; cin >> n >> capacity; vector values(n), weights(n); for (int i = 0; i < n; i++) { cin >> values[i]; } for (int i = 0; i < n; i++) { cin >> weights[i]; } int maximumValue = findMaximumValue(values, weights, capacity, n); cout << maximumValue << endl; return 0; }
def find_maximum_value(values, weights, capacity): n = len(values) dp = [[0] * (capacity + 1) for _ in range(n + 1)] for i in range(1, n + 1): for w in range(1, capacity + 1): if weights[i - 1] <= w: dp[i][w] = max(values[i - 1] + dp[i - 1][w - weights[i - 1]], dp[i - 1][w]) else: dp[i][w] = dp[i - 1][w] return dp[n][capacity] n = int(input()) capacity = int(input()) values = [] weights = [] for _ in range(n): values.append(int(input())) for _ in range(n): weights.append(int(input())) maximum_value = find_maximum_value(values, weights, capacity) print(maximum_value)
Free Material
Very Important
Paid Material
According to the latest syllabus of TCS
- TCS Coding Materials – 1
- TCS Coding Materials – 2
- TCS Coding Materials – 3
- TCS Coding Materials – 4
- TCS Coding Materials – 5
- TCS Coding Materials – 6
- TCS Coding Materials – 7
- TCS Coding Materials – 8
- TCS Coding Materials – 9
- TCS Coding Materials – 10
- TCS Coding Materials – 11
- TCS Coding Materials – 12
- TCS Coding Materials – 13
- TCS Coding Materials – 14
- TCS Coding Materials – 15
- TCS Coding Materials – 16
- TCS Coding Materials – 17
- TCS Coding Materials – 18
- TCS Coding Materials – 19
- TCS Coding Materials – 20
- TCS Coding Materials – 21
- TCS Coding Materials – 22
- TCS Coding Materials – 23
- TCS Coding Materials – 24
- TCS Coding Materials – 25
- TCS Coding Materials – 26
- TCS Coding Materials – 27
- TCS Coding Materials – 28
- TCS Coding Materials – 29
- TCS Coding Materials – 30
- TCS Coding Materials – 31
- TCS Coding Materials – 32
- TCS Coding Materials – 33
- TCS Coding Materials – 34
- TCS Coding Materials – 35
- TCS Coding Materials – 36
- TCS Coding Materials – 37
- TCS Coding Materials – 38
- TCS Coding Materials – 39
- TCS Coding Materials – 40
- TCS Coding Materials – 41
- TCS Coding Materials – 42
- TCS Coding Materials – 43
- TCS Coding Materials – 44
- TCS Coding Materials – 45
- TCS Coding Materials – 46
- TCS Coding Materials – 47
- TCS Coding Materials – 48
- TCS Coding Materials – 49
- TCS Coding Materials – 50
- TCS Coding Materials – 51
- TCS Coding Materials – 52
- TCS Coding Materials – 53
- TCS Coding Materials – 54
- TCS Coding Materials – 55
- TCS Coding Materials – 56
- TCS Coding Materials – 57
- TCS Coding Materials – 58
- TCS Coding Materials -59
Based on Previous Year Patterns
- TCS Coding Question -1
- TCS Coding Questions – 2
- TCS Coding Questions – 3
- TCS Coding Questions – 4
- TCS Coding Questions – 5
- TCS Coding Questions – 6
- TCS Coding Questions – 7
- TCS Coding Questions – 8
- TCS Coding Questions – 9
- TCS Coding Questions – 10
- TCS Coding Questions – 11
- TCS Coding Questions – 12
- TCS Coding Questions – 13
- TCS Coding Questions – 14
- TCS Coding Questions – 15
- TCS Coding Questions – 16
- TCS Coding Questions – 17
- TCS Coding Questions – 18
- TCS Coding Questions – 19
- TCS Coding Questions – 21
- TCS Coding Questions – 22
- TCS Coding Questions – 23
- TCS Coding Questions – 24
- TCS Coding Questions – 25
- TCS Coding Questions – 26
- TCS Coding Questions – 27
- TCS Coding Questions – 28
Prime Course Trailer
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
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
Qs 11 may be solved in python as….
def prime(n):
i,j=0,2
while i2: return(fibo(n-1)+fibo(n-2))
n=int(input(‘Enter N:’))
if n%2==0: print(prime(n//2))
else: print(fibo(n//2+1))
I think Programming 11 has some issue, plz chek it
ok Syed we’ll see to it
Please share the Code of WaterMark Solution Problem of TCS phase 2 test slot 1 on 1st sep 2019.
Will any command line programs come in TCS NQT 2020 in last round of coding section
Hi,
Command Line will not be used as a coding language in TCS Ninja Test. However, you need to learn command line programming, it is very important that you do. As 1 MCQ question in programming Logic section will be asked from command line programming basics.
Thank you sir. The questions that you gave above was repeated in my Bsc for tcs that happened on July 5, 2019. Thank you so much.
It was exact same I even knew the code as I did it a day before from your website. I hope that I clear my interview as well
what is the cut-off marks for TCS Ninja and how much we did need to score in order to get selected for TCS Digital .
Thank you sir. I got similar questions in the exam as well. Not the same question but the pattern was same.
Tcs paper pattern has changed.
They have kept args prog in mcq and coding section has changed.
Where can i get coding qstns according to the new one?