You are given a small social graph of users and friendships.
Across the interview, you will validate recommendation lists, generate valid recommendations, score candidates by mutual friends, and choose the best recommendation.
The project already contains a helper function that validates a list of suggested users for a target user.
However, the current implementation is incorrect: it may accept recommendation lists that should be rejected.
Your task is to debug and fix the validation logic so that:
- the target user cannot be recommended to themselves,
- existing friends cannot appear in the recommendation list,
- duplicate user IDs are rejected,
- unknown users are rejected.
You should make the provided unit tests pass.
test_rejects_self_recommendation
test_rejects_existing_friend
test_rejects_duplicates
test_accepts_clean_candidate_list