TCS NQT 2026 Coding Questions (Gym Fees + Duplicate Transaction)

tcs logo
tcs
March 20, 2026 · 5 reads

Summary

I encountered two coding questions, Gym Fees Calculator and Duplicate Transaction Detection, during the TCS NQT 2026, which involved a greedy approach and hash map/set for their solutions.

Full Experience

Hi everyone,

I came across these coding questions from TCS NQT 2026. Sharing here for practice.


🔹 Q1. Gym Fees Calculator

Plans: 3 months = 5000
6 months = 9000
9 months = 12000
12 months = 15000

Given N months, calculate total cost based on priority: 12 → 9 → 6 → 3

If not divisible by 3, print "Error"

👉 Concept: Greedy Algorithm


🔹 Q2. Duplicate Transaction Detection

Detect duplicate transactions where:

  • sender, receiver, amount are same
  • timestamp is different

👉 Concept: HashMap / HashSet


💡 Key Takeaways:

  • Greedy + Hashing are very important for TCS
  • Focus on basic logic and clean implementation

Would love to know if anyone else got similar questions!

Thanks 🚀

Interview Questions (2)

1.

Gym Fees Calculator

Data Structures & Algorithms

Plans: 3 months = 5000
6 months = 9000
9 months = 12000
12 months = 15000

Given N months, calculate total cost based on priority: 12 → 9 → 6 → 3

If not divisible by 3, print "Error"

2.

Duplicate Transaction Detection

Data Structures & Algorithms

Detect duplicate transactions where:

  • sender, receiver, amount are same
  • timestamp is different

Preparation Tips

My key takeaways were that greedy algorithms and hashing are very important for TCS, and it's crucial to focus on basic logic and clean implementation.

📣 Found this helpful? Please share it with friends who are preparing for interviews!

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

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