Air Traffic Controller

Your job as a newbie airtraffic controller will be to schedule in bound flights. You will be provided a list of flights with their arrival times and you will need to determine their landing times based on runway availability. In order to land each flight will need to reserve the runway for a fixed amount of time in order to safely land and taxi off the runway. If a flight is scheduled to arrive at the airport whilst the runway is occupied it will have to wait for the runway to be cleared before it can land.

Requirements

Notes


1. Single Runway

The HTTP POST request will come with a body of Content-Type: application/json. The body will consist of a

Sample input JSON
{
    "Flights": [
        {
            "PlaneId": "TR123",
            "Time": "0200"
        },
        {
            "PlaneId": "SQ255",
            "Time": "0210"
        },
        {
            "PlaneId": "TH544",
            "Time": "0155"
        },
        {
            "PlaneId": "BA123",
            "Time": "0212"
        },
        {
            "PlaneId": "VA521",
            "Time": "0230"
        }
    ],
    "Static": {
        "ReserveTime": "600"
    }
}

Sample output JSON

Result should return the list of flights sorted by scheduled landing time.

{
    "Flights": [
        {
            "PlaneId": "TH544",
            "Time": "0155"
        },
        {
            "PlaneId": "TR123",
            "Time": "0205"
        },
        {
            "PlaneId": "SQ255",
            "Time": "0215"
        },
        {
            "PlaneId": "BA123",
            "Time": "0225"
        },
        {
            "PlaneId": "VA521",
            "Time": "0235"
        }
    ]
}

2. Multiple Runways

The HTTP POST request will come with a body of Content-Type: application/json. The body will consist of a

Sample input JSON
{
    "Flights": [
        {
            "PlaneId": "TR123",
            "Time": "0200"
        },
        {
            "PlaneId": "SQ255",
            "Time": "0210"
        },
        {
            "PlaneId": "TH544",
            "Time": "0155"
        },
        {
            "PlaneId": "BA123",
            "Time": "0212"
        },
        {
            "PlaneId": "VA521",
            "Time": "0230"
        }
    ],
    "Static": {
        "Runways": ["A", "B"],
        "ReserveTime": "600"
    }
}

Sample output JSON

Result should return the list of flights sorted by landing times and their allocated runways.

{
    "Flights": [
        {
            "PlaneId": "TH544",
            "Time": "0155",
            "Runway": "A"
        },
        {
            "PlaneId": "TR123",
            "Time": "0200",
            "Runway": "B"
        },
        {
            "PlaneId": "SQ255",
            "Time": "0210",
            "Runway": "A"
        },
        {
            "PlaneId": "BA123",
            "Time": "0212",
            "Runway": "B",
        },
        {
            "PlaneId": "VA521",
            "Time": "0230",
            "Runway": "A"
        }
    ]
}


3. Distressed Flights

The HTTP POST request will come with a body of Content-Type: application/json. The body will consist of a

Sample input JSON

{
    "Flights": [
        {
            "PlaneId": "TR123",
            "Time": "0200",
            "Distressed": "true"
        },
        {
            "PlaneId": "SQ255",
            "Time": "0210"
        },
        {
            "PlaneId": "TH544",
            "Time": "0155"
        },
        {
            "PlaneId": "BA123",
            "Time": "0212"
        },
        {
            "PlaneId": "VA521",
            "Time": "0230"
        }
    ],
    "Static": {
        "Runways": ["A"],
        "ReserveTime": "600"
    }
}

Sample output JSON

Result should return the list of flights sorted by their scheduled landing times.

{
    "Flights": [
        {
            "PlaneId": "TR123",
            "Time": "0200",
            "Runway": "A"
        },
        {
            "PlaneId": "TH544",
            "Time": "0210",
            "Runway": "A"
        },
        {
            "PlaneId": "SQ255",
            "Time": "0220",
            "Runway": "A"
        },
        {
            "PlaneId": "BA123",
            "Time": "0230",
            "Runway": "A",
        },
        {
            "PlaneId": "VA521",
            "Time": "0240",
            "Runway": "A"
        }
    ]
}