EppsNet Archive: World Cup 2018

Competitive Programming: CodeSignal – footballGroupStatictics (A World Cup SQL Challenge)

Description You are creating a website that will help you and your friends keep track of the results of soccer games from all around the world. You store all results of one group in a table, results. You want to sort the teams in a complex way – first by points, then by total goal differences, and then by total goals. If all of these parameters are equal, sort the teams alphabetically. The results table contains the following columns: first_team – the name of the first team; second_team – the name of the second team; first_team_score – the number of goals scored by the first team; second_team_score – the number of goals scored by the second team. Here the primary key is the pair (first_team, second_team). Return the list of team names sorted in the way described above. Note: see three points for a win to understand how points are… Read more →

Competitive Programming: CodeSignal – canScore (A World Cup Challenge)

Description Your friend is a soccer fan and you were watching some World Cup matches with him. You liked this game, but the rules are very complicated for you, so you decided just to try to guess whether the given attack will end with a goal or not. In the beginning, the ball is in the attacking team’s goalkeeper’s hands. On the attacking team, there’s a very talented goalscorer, who is waiting for his chance at the other end of the field. His teammates want to give him the ball so he can score. They can move the ball by passing it one to another along a straight line, but the defender can steal the pass if he is closer than d to the ball at any point throughout the pass. Now you want to know if the attacking team can score or not. Formally, you are given the coordinates… Read more →