I cant solve the following problem

Juan has a birthday is coming up and he hasn’t made up his mind about who he will invite. Unfortunately for him (and you), not all his friends get along with each other. Therefore in order to avoid any conflict Juan must invite a subset of his friends such that all possible pairs of invited friends get along with each other.

Naturally, some people are more fun than others, so Juan has determined everyone’s fun level and wants to use it wants to maximize the amount of “fun” in his party.

Help Juan decide by finding the value of the optimal fun party he can have.

2 1 0 1
4 0 1 0
3 1 0 1


here is a link to the problem

my idea for solving the problem was the following,
i take all friendships and put them into a string i.e for 1 0 1 0 i make string 1010
and then i check with all others if that other string has 1 in all the places where first string has 1, then they can be invited to the party.
My solution passes two test examples, but when i evaluate it, it passes only 1/5.

Can you please give me a better idea or explain me why my idea doesnt work?
Thanks in advance

as n is only 15 total number of subsets is 2^15 which is small.
You can look at all the subsets and chose the optimal one (bruteforce).