TCS NQT | 21-03-2026 | 2nd Shift | Advanced Coding

Posted
24 Mar 2026
506 reads

Summary

This post details my experience in the TCS NQT Advanced Coding section, which featured two distinct programming challenges: one on calculating parking charges and another on maximizing the number of people in a hot air balloon based on weight capacity.

How it went

Advanced Coding Easy (25 mins)

A vehicle parking system charges based on the number of hours parked.

The billing is calculated as follows:

  • First 2 hours → 100 per hour
  • Next 3 hours (from 3rd to 5th hour) → 50 per hour
  • Beyond 5 hours → 20 per hour

Conditions:

  • If the input is not an integer (e.g., 1.5, 2.7), print "Error"
  • If the input is negative, print "Error"

Input Format: A single value H representing the number of hours parked

Output Format: Print the total parking charge or "Error" for invalid input

Example 1: Input: 2 Output: 200

Example 2: Input: 4 Output: 300

Example 3: Input: 7 Output: 390

Example 4: Input: 1.5 Output: Error

Example 5: Input: -3 Output: Error

Advanced Coding Medium (55 mins)

A hot air balloon has a maximum weight carrying capacity X.

There are N people waiting to board the balloon. The weight of each person is given in an array S of size N.

Your task is to determine the maximum number of people that can be accommodated in the balloon such that the total weight does not exceed X.

You must select people in such a way that the count of people is maximized.

Input Format: First line: Integer N (number of people) Second line: Integer X (maximum weight capacity) Third line: N space-separated integers representing weights of people

Output Format: Print a single integer representing the maximum number of people that can be accommodated.

Example 1: Input: 5 100 20 30 50 10 40

Output: 4

Example 2: Input: 4 50 20 20 30 10

Output: 3

Example 3: Input: 3 15 10 20 30

Output: 1

Explanation: In Example 1: Sorted weights → 10 20 30 40 50
Pick 10 → total = 10
Pick 20 → total = 30
Pick 30 → total = 60
Pick 40 → total = 100
Cannot pick 50 (exceeds capacity)

Maximum people = 4

Questions asked (2)

  1. 01

    Vehicle Parking System Charges Calculation

    Data Structures & Algorithms · Easy

    A vehicle parking system charges based on the number of hours parked.

    The billing is calculated as follows:

    • First 2 hours → 100 per hour
    • Next 3 hours (from 3rd to 5th hour) → 50 per hour
    • Beyond 5 hours → 20 per hour

    Conditions:

    • If the input is not an integer (e.g., 1.5, 2.7), print "Error"
    • If the input is negative, print "Error"

    Input Format: A single value H representing the number of hours parked

    Output Format: Print the total parking charge or "Error" for invalid input

    Example 1: Input: 2 Output: 200

    Example 2: Input: 4 Output: 300

    Example 3: Input: 7 Output: 390

    Example 4: Input: 1.5 Output: Error

    Example 5: Input: -3 Output: Error

  2. 02

    Maximize People in Hot Air Balloon

    Data Structures & Algorithms · Medium

    A hot air balloon has a maximum weight carrying capacity X.

    There are N people waiting to board the balloon. The weight of each person is given in an array S of size N.

    Your task is to determine the maximum number of people that can be accommodated in the balloon such that the total weight does not exceed X.

    You must select people in such a way that the count of people is maximized.

    Input Format: First line: Integer N (number of people) Second line: Integer X (maximum weight capacity) Third line: N space-separated integers representing weights of people

    Output Format: Print a single integer representing the maximum number of people that can be accommodated.

    Example 1: Input: 5 100 20 30 50 10 40

    Output: 4

    Example 2: Input: 4 50 20 20 30 10

    Output: 3

    Example 3: Input: 3 15 10 20 30

    Output: 1

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at TCS recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!