1. सीखें
  2. /
  3. पाठ्यक्रम
  4. /
  5. Optimizing Code in Java

Connected

अभ्यास

Implementing a duplicate transaction finder

Financial transaction logs must be validated to ensure each transaction ID is unique. Your task is to implement a method that efficiently checks for the presence of any duplicate transaction IDs.

निर्देश

100 XP
  • Initialize the seen variable as an empty Set.
  • Add transactions to seen if you've not encountered them before.
  • Return the appropriate boolean value if the loop ends without finding a duplicate.