1class Solution {2public int numPairsDivisibleBy60(int[] time) {3int[] hm = new int[61];4int n = time.length;5for (int i = 0; i < n; i++) time[i] = time[i] % 60;6int res = 0;7for (int i = 0; i < n; i++) {8if (hm[60 - time[i]] != 0) res = res + hm[60 - time[i]];9if (time[i] == 0) hm[60] += 1;10else hm[time[i]] += 1;11}12return res;13}14}