You will need the following to complete this coding challenge:
- Visual Studio, or any IDE that can be used for C#/.NET development
- SQL Server 2016 or later (any edition)
- Using Visual Studio, create a Web API project using any version of .NET (not .NET Framework) that is still under support.
- Optionally, add your project to a Git repo. Although this is not required, it is our preferred method to review your code. Note: Please do not attempt to add your code to this repo (through a fork or PR) as this would make your solution visible to others.
- Using SQL Server, run the
db_scripts\create_tea_test_db.sql
script. This script will create theSchool
database, set up the schema shown below, and populate it with test data.
Add an endpoint to return a list of students and their GPAs.
GET /students
- The endpoint should return JSON similar to that shown below.
- The GPA is not stored in the database, so it must be calculated.
- Ignore
null
grades when calculating the GPA.
[
{
"studentId":2,
"firstName":"Gytis",
"lastName":"Barzdukas",
"gpa":3.8
},
{
"studentId":3,
"firstName":"Peggy",
"lastName":"Justice",
"gpa":3.4
},
...
{
"studentId":30,
"firstName":"Alicia",
"lastName":"Shan",
"gpa":3.75
}
]
This challenge is unrelated to the School database or API, but should be included in the same solution.
Create a class named Challenge2
with the following method named
MaxDistance
:
public class Challenge2
{
public int MaxDistance(string input)
{
throw new NotImplementedException();
}
}
Implement MaxDistance
to return the maximum distance for a pair of letters in the string input
. The maximum distance is defined as the largest difference between any input[i]
and input[j]
where i < j
and input[i]
comes before input[j]
in the alphabet.
- Sample Input =
"gbcjbdha"
- Sample Output = 7
- Explanation: There are 7 letters between
'b'
and'j'
AND'b'
comes before'j'
alphabetically AND index of'j'
> index of'b'
- Make your solution available to us, ideally in a public Git repository. You may also try to email a zipped copy of your solution, but there is a chance this will be blocked. In that case, be prepared to use another method, such as Dropbox or Google Drive.
- Include any special instructions to run your code.