-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScore.java
37 lines (31 loc) · 888 Bytes
/
Score.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package Hashcode;
import Hashcode.Customer;
import java.util.List;
public class Score {
int calculate(List<Customer> cu,List<String>ans){
boolean liked;
boolean disliked;
int sc=0;
for(int i=0;i<cu.size();i++){
disliked=true;
liked=true;
for(String c:cu.get(i).likes){
if(!ans.contains(c)){
liked=false;
break;
}
}
for(String c:cu.get(i).dislikes){
if(ans.contains(c)){
disliked=false;
break;
}
}
//System.out.println(liked+" "+disliked);
if(liked==true && disliked==true){
sc++;
}
}
return sc;
}
}