TCS NQT 2026 Coding Questions (Gym Fees + Duplicate Transaction)
- Posted
- 20 Mar 2026
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.
How it went
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 🚀
Questions asked (2)
- 01
Gym Fees Calculator
Data Structures & Algorithms
Plans: 3 months = 5000
6 months = 9000
9 months = 12000
12 months = 15000Given N months, calculate total cost based on priority: 12 → 9 → 6 → 3
If not divisible by 3, print "Error"
- 02
Duplicate Transaction Detection
Data Structures & Algorithms
Detect duplicate transactions where:
- sender, receiver, amount are same
- timestamp is different
How they prepared
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.