TCS NQT 2026 Coding Questions (Gym Fees + Duplicate Transaction)
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)
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"
Duplicate Transaction Detection
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.