Yelp OA
Anonymous User
5398

How would you solve this?

image

// <-- EXPAND to see the data classes
import java.io.;
import java.util.
;
import org.json.simple.parser.JSONParser;
import org.json.simple.JSONObject;
import org.json.simple.JSONArray;

class PositiveReview {
Integer userId;
Integer businessId;

public PositiveReview(Integer userId, Integer businessId) {
    this.userId = userId;
    this.businessId = businessId;
}

public Integer getUserId() {
    return this.userId;
}
public Integer getBusinessId() {
    return this.businessId;
}

}

class Solution {
/*
Sample Input
{
"businessOfInterestId": 10,
"positiveReviews": [
PositiveReview(
"userId": 1,
"businessId": 10
),
PositiveReview(
"userId": 2,
"businessId": 10
),
PositiveReview(
"userId": 1,
"businessId": 11
),
PositiveReview(
"userId": 2,
"businessId": 11
),
PositiveReview(
"userId": 1,
"businessId": 12
),
PositiveReview(
"userId": 2,
"businessId": 12
),
PositiveReview(
"userId": 3,
"businessId": 12
)
]
}

Sample Output
    11

Business Similarity Score against business 10:
    11: 2 / (2 + 2 - 2) = 1.0
    12: 2 / (2 + 3 - 2) = 0.667
*/
public static Integer findMostSimilarBusiness(
    Integer businessOfInterestId,
    List<PositiveReview> positiveReviews
) {
         
}

public static void main(String[] args) {
Comments (5)