TCS NQT coding questions (2026): practice problems with solutions
Ten practice problems in the style of the coding questions students report from the TCS NQT: arrays, strings, maths, greedy and simple dynamic programming. Each one has the idea in plain words, a solution in Python, C++ and Java that we ran against the examples and extra edge cases, and its time and space complexity.
We wrote every problem ourselves to match the common question types, so these aren't official TCS questions. Use them to learn the patterns, then take the real test on your own.
The problems
- Move the empty slots to the endArrays · Easy
- Find the second-highest scoreArrays · Easy
- Rotate the display boardArrays · Easy
- Reverse the words in a sentenceStrings · Easy
- Are two names made of the same letters?Strings · Counting · Easy
- Count the primes in a rangeMaths · Medium
- When do the two lights blink together?Maths · GCD and LCM · Easy
- Pay an amount with the fewest notesGreedy · Easy
- The best run of daysSimple DP · Arrays · Medium
- Ways to climb the stairsSimple DP · Medium
The TCS NQT at a glance
From TCS's NQT hiring page for the batches of 2024, 2025 and 2026. Registration for that drive opened on 18 February 2026 and tests ran from 10 March 2026; the page showed registration as closed when we checked, so look there for the next drive.
| Part | Sections | Time |
|---|---|---|
| A: Foundation | Numerical Ability, Verbal Ability and Reasoning Ability, 25 minutes each | 75 minutes |
| B: Advanced | Advanced Quantitative & Reasoning Ability (25 minutes) and Advanced Coding (90 minutes) | 115 minutes |
| Total | One integrated test, taken at a TCS iON centre | 190 minutes |
- TCS encourages everyone to attempt both parts and says the Advanced section is mandatory for a Digital or Prime offer. Based on the test, candidates qualify for Prime, Digital or Ninja interviews.
- Who could apply: the batches of 2024, 2025 and 2026 with a B.Tech, B.E., M.Tech, M.E., MCA or M.Sc/M.S in any specialisation, from a university or college recognised by AICTE or UGC. Full-time courses only.
- Marks: at least 60% (or the equivalent CGPA) in Class 10, Class 12, diploma (if any), graduation and post-graduation (if any). TCS's own example turns CGPA into a percentage by multiplying by 10, so 7.2 becomes 72%.
- Backlogs and gaps: no pending backlog when you take the test, the course finished in its normal duration, and a total gap in education of no more than 24 months (any gap must be declared).
- Age and experience: 18 to 28 years old, with up to 2 years of work experience.
- TCS's page doesn't say how many coding questions there are, so we haven't guessed.
Source: TCS's All India NQT hiring page on tcs.com. Checked on 11 October 2026. The rules can change with each drive, so check the page before you apply.
How to practise with this page
- Try first, then read. Give each problem 20 to 30 minutes before you open the solution, and write the idea in one line before you code.
- Read the input exactly as described. Many wrong answers come from reading the input the wrong way, not from the logic. The solutions here read everything at once and split it on spaces and new lines, so they work either way.
- Check the limits before you choose an approach. With N up to 105, a loop inside a loop is about 1010 steps, which is far too slow. Aim for O(N) or O(N log N).
- Test the edge cases yourself: one element, all values equal, and the largest values. When a result can pass about 2 × 109, use
long longin C++ orlongin Java. - Practise against the clock. TCS's page gives 90 minutes for Advanced Coding, so time your practice sessions the same way.
1Move the empty slots to the end
A parking row has N slots in a line. Each slot holds a car's number (a positive whole number) or 0 if it's empty. Move every car towards the front without changing their order, so that all the empty slots end up at the back.
- Input
- The first line has N (1 ≤ N ≤ 105). The second line has N numbers, each 0 or a car number up to 109.
- Output
- The N slots after the move, separated by spaces.
Example input
6 0 4 0 7 2 0
Output
4 7 2 0 0 0
The cars 4, 7 and 2 keep their order, and the three empty slots move to the back.
Approach
Keep a marker called write that points at the next free place at the front. Walk through the row once: whenever you see a car, copy it to write and move write one step on. When you reach the end, fill everything from write onwards with 0. Nothing gets sorted, so the cars stay in their original order.
The Python version does the same thing in two lines: keep the cars in order, then add the right number of zeros.
Solution
Python
import sys
data = list(map(int, sys.stdin.read().split()))
n, slots = data[0], data[1:]
cars = [x for x in slots[:n] if x != 0] # cars, in their order
print(*(cars + [0] * (n - len(cars)))) # then the empty slotsC++
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int &x : a) cin >> x;
int write = 0; // next place for a car
for (int i = 0; i < n; i++)
if (a[i] != 0) a[write++] = a[i];
while (write < n) a[write++] = 0; // the rest are empty
for (int i = 0; i < n; i++)
cout << a[i] << (i + 1 < n ? ' ' : '\n');
}Java
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) a[i] = sc.nextInt();
int write = 0; // next place for a car
for (int i = 0; i < n; i++)
if (a[i] != 0) a[write++] = a[i];
while (write < n) a[write++] = 0; // the rest are empty
StringBuilder out = new StringBuilder();
for (int i = 0; i < n; i++) out.append(a[i]).append(i + 1 < n ? " " : "\n");
System.out.print(out);
}
}Time: O(N) · Extra space: O(1) in C++ and Java (the Python version builds a new list, so O(N))
2Find the second-highest score
A quiz has N players. Print the second-highest distinct score: the highest score that is lower than the top score. If every player has the same score, there is no second-highest, so print -1.
- Input
- N (1 ≤ N ≤ 105), then N scores, each from 0 to 109.
- Output
- One number: the second-highest distinct score, or -1.
Example 1 input
5 10 40 30 40 20
Output
30
Example 2 input
3 7 7 7
Output
-1
In the first example the top score is 40 (twice), and the next distinct score is 30. In the second, everyone scored 7.
Approach
Sorting works, but it takes O(N log N) and needs care with repeated values. Instead, walk through the scores once and remember two numbers: first, the best so far, and second.
When a score beats first, the old first drops to second. When a score is lower than first but higher than second, it becomes the new second. A score equal to first is skipped, which is what keeps the answer distinct. Both start at -1, which is safe because scores are never negative.
Solution
Python
import sys
data = list(map(int, sys.stdin.read().split()))
n, scores = data[0], data[1:]
first = second = -1
for x in scores[:n]:
if x > first:
first, second = x, first # old top score moves to second place
elif first > x > second:
second = x
print(second)C++
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
long long first = -1, second = -1;
for (int i = 0; i < n; i++) {
long long x;
cin >> x;
if (x > first) {
second = first; // old top score moves to second place
first = x;
} else if (x < first && x > second) {
second = x;
}
}
cout << second << '\n';
}Java
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long first = -1, second = -1;
for (int i = 0; i < n; i++) {
long x = sc.nextLong();
if (x > first) {
second = first; // old top score moves to second place
first = x;
} else if (x < first && x > second) {
second = x;
}
}
System.out.println(second);
}
}Time: O(N) · Extra space: O(1)
3Rotate the display board
A display board shows N numbers in a row. Every second, each number moves one place to the right, and the last number wraps around to the front. Print the board after K seconds. K can be very large.
- Input
- N and K on the first line (1 ≤ N ≤ 105, 0 ≤ K ≤ 109), then the N numbers (each between -109 and 109).
- Output
- The N numbers after K seconds, separated by spaces.
Example input
5 2 1 2 3 4 5
Output
4 5 1 2 3
After 1 second the board shows 5 1 2 3 4; after 2 seconds, 4 5 1 2 3.
Approach
Moving everything one step, K times, takes N × K steps: far too slow when K is 109. Notice that after N seconds the board is back where it started, so only K mod N seconds matter.
After that, the number at position i simply lands at position (i + K) mod N. In Python the same idea reads as "the last K numbers, followed by the rest".
Solution
Python
import sys
data = list(map(int, sys.stdin.read().split()))
n, k, board = data[0], data[1], data[2:]
board = board[:n]
k %= n # after n seconds the board looks the same again
print(*(board[n - k:] + board[:n - k]))C++
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
long long k;
cin >> n >> k;
vector<long long> a(n), res(n);
for (auto &x : a) cin >> x;
k %= n; // after n seconds the board looks the same again
for (int i = 0; i < n; i++) res[(i + k) % n] = a[i];
for (int i = 0; i < n; i++)
cout << res[i] << (i + 1 < n ? ' ' : '\n');
}Java
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long k = sc.nextLong();
long[] a = new long[n], res = new long[n];
for (int i = 0; i < n; i++) a[i] = sc.nextLong();
int shift = (int) (k % n); // after n seconds the board looks the same again
for (int i = 0; i < n; i++) res[(i + shift) % n] = a[i];
StringBuilder out = new StringBuilder();
for (int i = 0; i < n; i++) out.append(res[i]).append(i + 1 < n ? " " : "\n");
System.out.print(out);
}
}Time: O(N) · Extra space: O(N) for the answer
4Reverse the words in a sentence
Given one line of text, print its words in reverse order. Words are separated by one or more spaces, and there may be spaces at the start or the end. Print the words separated by single spaces.
- Input
- One line with at most 105 characters.
- Output
- The words in reverse order, separated by single spaces.
Example input
practice makes perfect
Output
perfect makes practice
The extra spaces between "makes" and "perfect" don't appear in the answer.
Approach
Split the line into words in a way that skips any number of spaces, then print the words from the last to the first. Python's split() with no argument does this, C++'s >> skips spaces when reading word by word, and in Java trim() plus split("\\s+") does the same job.
A common slip: splitting on a single space gives empty "words" wherever there are two spaces in a row, and they show up as extra gaps in the output.
Solution
Python
import sys
words = sys.stdin.readline().split() # split() also drops extra spaces
print(" ".join(reversed(words)))C++
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
int main() {
string line, word;
getline(cin, line);
istringstream in(line);
vector<string> words;
while (in >> word) words.push_back(word); // skips extra spaces
for (int i = (int)words.size() - 1; i >= 0; i--)
cout << words[i] << (i > 0 ? " " : "");
cout << '\n';
}Java
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = br.readLine();
if (line == null) line = "";
String[] words = line.trim().split("\\s+"); // one or more spaces
StringBuilder out = new StringBuilder();
for (int i = words.length - 1; i >= 0; i--) {
out.append(words[i]);
if (i > 0) out.append(' ');
}
System.out.println(out);
}
}Time: O(L), where L is the length of the line · Extra space: O(L)
5Are two names made of the same letters?
Two names are "letter twins" if you can rearrange the letters of one to get the other. Ignore spaces, and treat capital and small letters as the same. Print YES if the two names are letter twins and NO if they aren't.
- Input
- Two lines, each with up to 105 characters (English letters and spaces).
- Output
- YES or NO.
Example 1 input
Dormitory Dirty room
Output
YES
Example 2 input
Listen Silentt
Output
NO
Both names in the first example use the letters d, i, m, o, o, r, r, t, y. In the second, the second name has an extra t.
Approach
Sorting the letters of both names and comparing them works, in O(L log L). Counting is faster: keep 26 counters, one per letter. Add 1 for every letter in the first name and subtract 1 for every letter in the second, skipping spaces and turning capitals into small letters first.
If every counter ends at 0, both names use exactly the same letters the same number of times.
Solution
Python
import sys
from collections import Counter
def letters(name):
return Counter(ch.lower() for ch in name if ch.isalpha())
first = sys.stdin.readline()
second = sys.stdin.readline()
print("YES" if letters(first) == letters(second) else "NO")C++
#include <cctype>
#include <iostream>
#include <string>
using namespace std;
int main() {
string a, b;
getline(cin, a);
getline(cin, b);
int count[26] = {0}; // +1 for each letter in a, -1 for each in b
for (char c : a) {
c = tolower((unsigned char)c);
if (c >= 'a' && c <= 'z') count[c - 'a']++;
}
for (char c : b) {
c = tolower((unsigned char)c);
if (c >= 'a' && c <= 'z') count[c - 'a']--;
}
for (int i = 0; i < 26; i++) {
if (count[i] != 0) {
cout << "NO\n";
return 0;
}
}
cout << "YES\n";
}Java
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String a = br.readLine(), b = br.readLine();
if (a == null) a = "";
if (b == null) b = "";
int[] count = new int[26]; // +1 for each letter in a, -1 for each in b
for (char c : a.toLowerCase().toCharArray())
if (c >= 'a' && c <= 'z') count[c - 'a']++;
for (char c : b.toLowerCase().toCharArray())
if (c >= 'a' && c <= 'z') count[c - 'a']--;
for (int x : count) {
if (x != 0) {
System.out.println("NO");
return;
}
}
System.out.println("YES");
}
}Time: O(L) · Extra space: O(1): just 26 counters
6Count the primes in a range
Print how many prime numbers lie between L and R, including L and R themselves. A prime has exactly two divisors, 1 and itself, so 1 is not a prime.
- Input
- L and R (1 ≤ L ≤ R ≤ 106).
- Output
- One number: how many primes there are from L to R.
Example input
10 30
Output
6
The primes are 11, 13, 17, 19, 23 and 29.
Approach
Testing each number by dividing it by everything up to its square root works, but with a million numbers the Sieve of Eratosthenes is much faster. Start with every number from 2 to R marked as prime. For each i from 2 while i × i ≤ R, if i is still marked, cross out its multiples, starting from i × i (smaller multiples were already crossed out by smaller primes).
At the end, count the numbers from L to R that are still marked.
Solution
Python
import sys
low, high = map(int, sys.stdin.read().split())
is_prime = [True] * (high + 1)
is_prime[0] = is_prime[1] = False
i = 2
while i * i <= high:
if is_prime[i]:
for j in range(i * i, high + 1, i): # cross out multiples of i
is_prime[j] = False
i += 1
print(sum(is_prime[low:high + 1]))C++
#include <iostream>
#include <vector>
using namespace std;
int main() {
int low, high;
cin >> low >> high;
vector<bool> isPrime(high + 1, true);
isPrime[0] = isPrime[1] = false;
for (long long i = 2; i * i <= high; i++)
if (isPrime[i])
for (long long j = i * i; j <= high; j += i) // cross out multiples of i
isPrime[j] = false;
int count = 0;
for (int x = low; x <= high; x++)
if (isPrime[x]) count++;
cout << count << '\n';
}Java
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int low = sc.nextInt(), high = sc.nextInt();
boolean[] composite = new boolean[high + 1]; // false means "still looks prime"
composite[0] = composite[1] = true;
for (long i = 2; i * i <= high; i++)
if (!composite[(int) i])
for (long j = i * i; j <= high; j += i) // cross out multiples of i
composite[(int) j] = true;
int count = 0;
for (int x = low; x <= high; x++)
if (!composite[x]) count++;
System.out.println(count);
}
}Time: O(R log log R) · Extra space: O(R)
7When do the two lights blink together?
Two lights blink together at time 0. After that, the first blinks every A seconds and the second every B seconds. After how many seconds will they next blink together?
- Input
- A and B (1 ≤ A, B ≤ 109).
- Output
- One number: the seconds until they next blink together. It can be as big as 1018, so use 64-bit integers (
long longin C++,longin Java).
Example input
4 6
Output
12
The first light blinks at 4, 8, 12 and so on; the second at 6, 12 and so on. 12 is the first time they meet.
Approach
The answer is the least common multiple (LCM) of A and B, and LCM(A, B) = A × B ÷ GCD(A, B).
Find the GCD with Euclid's method: keep replacing (a, b) with (b, a mod b) until b is 0; then a is the GCD. Divide before you multiply (A ÷ GCD × B), so the number in the middle never gets bigger than the answer.
Solution
Python
import sys
from math import gcd # Python has gcd built in
a, b = map(int, sys.stdin.read().split())
print(a // gcd(a, b) * b) # divide first to keep the numbers smallC++
#include <iostream>
using namespace std;
long long gcd(long long a, long long b) {
while (b != 0) { // Euclid: gcd(a, b) = gcd(b, a % b)
long long r = a % b;
a = b;
b = r;
}
return a;
}
int main() {
long long a, b;
cin >> a >> b;
cout << a / gcd(a, b) * b << '\n'; // divide first to avoid overflow
}Java
import java.util.*;
public class Main {
static long gcd(long a, long b) {
while (b != 0) { // Euclid: gcd(a, b) = gcd(b, a % b)
long r = a % b;
a = b;
b = r;
}
return a;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long a = sc.nextLong(), b = sc.nextLong();
System.out.println(a / gcd(a, b) * b); // divide first to avoid overflow
}
}Time: O(log min(A, B)) · Extra space: O(1)
8Pay an amount with the fewest notes
You must pay exactly N rupees using notes and coins of ₹500, ₹200, ₹100, ₹50, ₹20, ₹10, ₹5, ₹2 and ₹1, and you have as many of each as you need. Use as few pieces as possible.
Print the total number of pieces. Then, from the largest value to the smallest, print one line for each value you used: the value and how many of it.
- Input
- N (1 ≤ N ≤ 109).
- Output
- The total number of pieces, then one line of "value count" for each value used.
Example input
1789
Output
10 500 3 200 1 50 1 20 1 10 1 5 1 2 2
1,500 + 200 + 50 + 20 + 10 + 5 + 4 = 1,789, using 10 pieces.
Approach
Greedy: take as many of the biggest note as fit, then move on to the next one. One division gives both the count and what's left over.
Greedy gives the fewest pieces for these values (we checked every amount up to 3,000 against an exact method), but not for every set of coins. With coins of 1, 3 and 4, greedy pays 6 as 4 + 1 + 1, three coins, while 3 + 3 needs only two. For sets like that you need dynamic programming.
Solution
Python
import sys
amount = int(sys.stdin.read())
notes = [500, 200, 100, 50, 20, 10, 5, 2, 1]
used = []
for note in notes: # biggest note first
count, amount = divmod(amount, note)
if count:
used.append((note, count))
print(sum(count for _, count in used))
for note, count in used:
print(note, count)C++
#include <iostream>
#include <utility>
#include <vector>
using namespace std;
int main() {
long long amount;
cin >> amount;
int notes[] = {500, 200, 100, 50, 20, 10, 5, 2, 1};
vector<pair<int, long long>> used;
long long total = 0;
for (int note : notes) { // biggest note first
long long count = amount / note;
amount %= note;
if (count > 0) {
used.push_back({note, count});
total += count;
}
}
cout << total << '\n';
for (auto &[note, count] : used) cout << note << ' ' << count << '\n';
}Java
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long amount = sc.nextLong();
int[] notes = {500, 200, 100, 50, 20, 10, 5, 2, 1};
StringBuilder lines = new StringBuilder();
long total = 0;
for (int note : notes) { // biggest note first
long count = amount / note;
amount %= note;
if (count > 0) {
lines.append(note).append(' ').append(count).append('\n');
total += count;
}
}
System.out.println(total);
System.out.print(lines);
}
}Time: O(1): there are only 9 values · Extra space: O(1)
9The best run of days
A shop writes down its profit for each of N days, with a loss written as a negative number. Find the largest total profit over any run of one or more days in a row.
- Input
- N (1 ≤ N ≤ 105), then N numbers, each between -104 and 104.
- Output
- One number: the best total.
Example 1 input
7 3 -4 5 -1 6 -8 2
Output
10
Example 2 input
3 -5 -2 -9
Output
-2
In the first example, days 3 to 5 give 5 − 1 + 6 = 10. In the second, every day is a loss, so the best run is the single smallest loss.
Approach
This is Kadane's algorithm. Walk through the days keeping current, the best total of a run that ends today. For each day, either extend yesterday's run (current + x) or start a new run today (x), whichever is bigger. Remember the largest current you ever see.
Start both numbers with the first day's value rather than 0, so that a list of only losses gives the smallest loss instead of a wrong 0.
Solution
Python
import sys
data = list(map(int, sys.stdin.read().split()))
n, profit = data[0], data[1:]
best = current = profit[0]
for x in profit[1:n]:
current = max(x, current + x) # keep the run going, or start again today
best = max(best, current)
print(best)C++
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
long long x;
cin >> x;
long long best = x, current = x;
for (int i = 1; i < n; i++) {
cin >> x;
current = max(x, current + x); // keep the run going, or start again today
best = max(best, current);
}
cout << best << '\n';
}Java
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long x = sc.nextLong();
long best = x, current = x;
for (int i = 1; i < n; i++) {
x = sc.nextLong();
current = Math.max(x, current + x); // keep the run going, or start again today
best = Math.max(best, current);
}
System.out.println(best);
}
}Time: O(N) · Extra space: O(1)
10Ways to climb the stairs
A child climbs a staircase of N steps, taking 1, 2 or 3 steps at a time. In how many different ways can the child reach the top? The number grows quickly, so print it modulo 1,000,000,007.
- Input
- N (1 ≤ N ≤ 106).
- Output
- The number of ways, modulo 1,000,000,007.
Example input
4
Output
7
1+1+1+1, 1+1+2, 1+2+1, 2+1+1, 2+2, 1+3 and 3+1.
Approach
The last hop onto step i was 1, 2 or 3 steps long, so ways(i) = ways(i − 1) + ways(i − 2) + ways(i − 3), with ways(0) = 1 (standing on the ground) and no ways to reach a step below 0.
Each value only needs the three before it, so three variables are enough; there's no need for an array. Take the modulo at every step so the numbers stay small.
Solution
Python
import sys
MOD = 1_000_000_007
n = int(sys.stdin.read())
# a, b, c = ways to reach the three steps just below the current one
a, b, c = 0, 0, 1 # the ground (step 0) can be "reached" in 1 way
for _ in range(n):
a, b, c = b, c, (a + b + c) % MOD
print(c)C++
#include <iostream>
using namespace std;
int main() {
const long long MOD = 1000000007;
int n;
cin >> n;
// a, b, c = ways to reach the three steps just below the current one
long long a = 0, b = 0, c = 1; // the ground (step 0) can be "reached" in 1 way
for (int i = 0; i < n; i++) {
long long next = (a + b + c) % MOD;
a = b;
b = c;
c = next;
}
cout << c << '\n';
}Java
import java.util.*;
public class Main {
public static void main(String[] args) {
final long MOD = 1_000_000_007L;
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
// a, b, c = ways to reach the three steps just below the current one
long a = 0, b = 0, c = 1; // the ground (step 0) can be "reached" in 1 way
for (int i = 0; i < n; i++) {
long next = (a + b + c) % MOD;
a = b;
b = c;
c = next;
}
System.out.println(c);
}
}Time: O(N) · Extra space: O(1)
Questions
How long is the TCS NQT?
TCS's NQT hiring page describes one integrated test of 190 minutes: Part A, Foundation, takes 75 minutes (Numerical, Verbal and Reasoning Ability), and Part B, Advanced, takes 115 minutes (Advanced Quantitative & Reasoning Ability for 25 minutes and Advanced Coding for 90 minutes). We checked this on 11 October 2026.
Is the Advanced section compulsory?
TCS encourages everyone to attempt both parts, and says the Advanced section is mandatory if you want a Digital or Prime offer.
Are these real TCS NQT questions?
No. We wrote them ourselves in the style of the question types students commonly report: arrays, strings, maths, greedy and simple dynamic programming. Learning these patterns helps far more than memorising answers.
Which language should I practise in?
The one you write fastest and with the fewest mistakes. Python is the shortest to write, while C++ and Java run faster on big inputs. Every problem here is solved in all three, so you can compare them side by side.
Were these solutions tested?
Yes. We ran every solution in Python, C++ and Java on the examples, on extra edge cases, on random inputs checked against a slow but simple answer, and on the largest inputs the limits allow.
More placement prep
- Infosys and Accenture coding questions: 10 practice problems from strings to greedy and dynamic programming, with each test's format from the companies' own pages.
- Wipro coding questions: 8 practice problems on arrays, strings, number logic and grids, with what Wipro's hiring pages say about Elite, Turbo and WILP.
- Cognizant GenC coding questions: 8 practice problems on strings, counting, stacks and greedy, with what Cognizant's pages say about GenC hiring.
- Capgemini coding questions: 8 practice problems from number theory and prefix sums to a simple DP, with Capgemini's hiring process from its own pages.
- HR interview questions for freshers: 20 common questions, what each one is really asking, and sample answers in English and Hinglish.
- Tell me about yourself: sample answer for freshers: Three sample answers in English with a Hinglish version of each, what the interviewer is really asking and how to make it yours.
- DSA interview questions with solutions: 10 DSA questions students report from campus placements, with the idea, complexity and links to practice problems with tested code.
- Mass recruiter vs product-based strategy for freshers
- Striver vs Love Babbar DSA sheet: which one for placements
- Tier-3 college placement guide: off-campus, projects and referrals
- 60% criteria for placements: TCS, Wipro, Capgemini, Accenture eligibility
- Take-home assignment for freshers: what it is, how long and what to submit
- Backlog and CGPA eligibility for TCS NQT and placements: 6.5 and 1 backlog
- Cognizant GenC vs GenC Next, Pro and standard: tracks, roles and preparation