Clarity on overriding equals() and hashcode() in Java

Правка en1, от rohantrix, 2021-12-28 21:27:01

In today's Codeforces Round (#763) problem B, I tried finding a pair object in a HashSet. Even after overriding equals() and hashcode() methods, I still ended up with WA on test 4. Here is the link to my solutions:

1) WA Submission using HashSet

2) Working Solution using 2D matrix

Please let me know of a good fix for this.

vinam SecondThread

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский rohantrix 2021-12-28 21:27:01 577 Initial revision (published)