Fantasy game lineup question - Urgent
Anonymous User
546

Anyone know how to solve this?

Three data models are given:
lineup:

[
{
"playerId": 132,
"position": "QB"
}
]
players:

[
{
"playerId": 123,
"teamId": 222,
"name": "Joe",
"salary": 5000
}
]
contest:

{
"id": 123,
"salaryCap": 90000,
"positionsRequired": ["Q", "RB", "WR"],
"games": [{
"gameId": 343,
"homeTeamId": 222,
"awayTeamId": 444
}]
}
write a validation method to validate a lineup and return true/false.

6 small questions are,

All roster positions listed in the contest must be filled by the lineup
The lineup must encompass at least two games
There can not be more than 3 players on a single team per game
The sum of player salary cannot exceed the contests max salary cap
The lineup cannot contain more than the required amount of players
Any single player can only be used once

Comments (0)