DriveReady

CODING — ALL IN ONE

Everything: platform, input handling, the 62-question bank, patterns, exam protocol

What this merges. Your local corpus analysis (11 papers, PYQ repo, /TCS folder, Placement Lelo → 62 ranked questions with brute-force + optimal Java, compiled and tested with 87 assertions), plus a fresh deepest-pass of online research on the 2026 platform, partial marking, and what recent candidates actually report.

The single most important sentence in this file:

⚠️ More people fail this section because they cannot read the input correctly than because their logic is wrong.

That is not my opinion — it is the consistent finding across platform guides and candidate reports. Everything in §2 exists because of it.


§1 · THE FORMAT — what you are walking into

Problems2 (some 2025 batches reported 3)
Time90 minutes shared across both — some sources say 45; batch-dependent
PlatformTCS iON
LanguagesC · C++ · Java · Python 3 · Perl
Marking⭐ PARTIAL — per test case passed
Test casestypically 2 visible + several hidden
DifficultyQ1 easy (I/O, strings, simple arrays) · Q2 medium (nested loops, conditionals, edge cases)
Navigationno going back once submitted (see 08)

⭐ Partial marking changes everything

A solution passing 5 of 14 test cases scores vastly better than one passing 0.

Consequences you must internalise:

  1. NEVER submit nothing. A brute-force that works on small inputs earns real marks. An elegant unfinished solution earns zero.
  2. A working O(n²) beats an unfinished O(n). Write the brute force first, confirm it runs, then optimise if time allows.
  3. Handle the easy cases even if you cannot handle all of them. If you cannot crack the general case, code the special cases you can — those test cases still count.
  4. Compile-and-run early and often. Code that does not compile scores zero regardless of how good the logic is.

Time allocation

Secure Q1 completely before touching Q2.

0–5 min    Read BOTH problems. Decide which is easier. (They are not always in order.)
5–35 min   Solve the easier one FULLY. Test it. Submit.
35–80 min  Attack the harder one. Brute force first.
80–90 min  Ensure SOMETHING is submitted for both. Handle edge cases.

§2 · ⭐ INPUT HANDLING — the actual gatekeeper

This section is longer than the algorithms section on purpose. This is where the marks are lost.

The TCS iON compiler is strict about input formats and whitespace, and problem statements are often vague about the exact format. Your algorithm can be perfect and still score zero.

The four formats TCS uses

Format A — Space-separated on one line

5
1 2 3 4 5
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();
        // solve
    }
}

Format B — Newline-separated

5
1
2
3
4
5

sc.nextInt() handles BOTH A and B identically — it skips all whitespace including newlines. This is why Scanner-with-nextInt is the safest default.

Format C — Comma-separated

1,2,3,4,5
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine().trim();
        String[] parts = line.split(",");
        int[] a = new int[parts.length];
        for (int i = 0; i < parts.length; i++)
            a[i] = Integer.parseInt(parts[i].trim());   // trim() is essential
        // solve
    }
}

Format D — Command-line arguments

java Main 1 2 3 4 5
public class Main {
    public static void main(String[] args) {
        int[] a = new int[args.length];
        for (int i = 0; i < args.length; i++)
            a[i] = Integer.parseInt(args[i]);
        // solve
    }
}

🔴 CONFIRMED BY 2026 CANDIDATES: Scanner.nextInt() FAILS

This is no longer a theoretical warning. Real reports:

"In my shift the input was in String. Many people were trying to take the input in nextInt() and they were not able to solve the problem." — 21 July

"Scanner nahi chal raha tha [Scanner wasn't working]… I didn't even know that if Scanner doesn't work you have to pass it via String." — 19 July

"Instead of using nextInt() directly, taking it as a String and parsing to integer is safer."

"TCS me input khud se lena padta hai" [in TCS you have to read the input yourself]."

What this means

Do not assume nextInt() will work. Multiple candidates lost entire questions to this — not to bad logic, to input reading.

⭐ Default to: read the whole line as a String, then parse the numbers out.

That is precisely what the universal reader below does. This is the single most valuable code block in this file, and 2026 candidates confirm it.


This lesson is part of full access

One payment of ₹250 opens every lesson, practice set and mock for all five companies. No subscription, no expiry.

What is inside

  • ⚠️ More people fail this section because they cannot read the input correctly than because their logic is wrong.
  • ⭐ Partial marking changes everything
  • Time allocation
  • The four formats TCS uses
  • 🔴 CONFIRMED BY 2026 CANDIDATES: Scanner.nextInt() FAILS
  • ⭐ THE UNIVERSAL READER — use this when the format is unclear
  • The five input mistakes that cost the most
  • 🔴 THREE COMPILER FACTS THAT COST CANDIDATES MARKS IN 2026
  • Output discipline
  • ⭐ Scanner vs BufferedReader
  • ⭐ Never concatenate Strings in a loop
  • Fast output for many lines
  • Overflow
  • The ranking (by independent-source corroboration)