0% found this document useful (0 votes)
585 views3 pages

AffordMed Interview Process Guide

The document outlines the development of two HTTP microservices: number-management-service and prefix-management-service. The first service retrieves and merges unique integers from a list of provided URLs, while the second service identifies keywords and returns their smallest unique prefixes. Both services include specific acceptance criteria and expected outputs for testing purposes.

Uploaded by

vinupriyatpc
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
585 views3 pages

AffordMed Interview Process Guide

The document outlines the development of two HTTP microservices: number-management-service and prefix-management-service. The first service retrieves and merges unique integers from a list of provided URLs, while the second service identifies keywords and returns their smallest unique prefixes. Both services include specific acceptance criteria and expected outputs for testing purposes.

Uploaded by

vinupriyatpc
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Problem1:

Develop a HTTP microservice called number-management-


service that exposes a GET REST API "/numbers". This API
receives a list of URLs through query parameters. This query
param is called "url". It can appear more than once, for
example:

[Link]
primes&url=[Link]

When API /numbers is called, your service shall retrieve each


of these URLs if they turn out to be syntactically valid URLs.
Each URL will return a JSON data structure that looks like this:
{
"numbers": [ 1, 2, 3, 5, 8, 13 ]
}
Below are the acceptance criteria :

1. collect response from each valid URLs


2. merge integers received from each URLs
3. sort them in ascending order and ensure each integer
appears only once
4. return response to the caller like
{
"numbers": [merged unique integers]
}

5. your service must return the response as quickly as


possible (never later than 500 milliseconds)
6. If remote URL takes too long to respond, it must be
ignored. The timeout must be respected regardless of
the size of the data.

Help:
For your convenience, we are giving you a test server which
exposes APIs like
/primes
/fibo
/odd
/rand
BaseURL: [Link] PrimesURL: http://
localhost:8090/primes

If you have golang installed on your system, following


command will help you run this test server
cd problem1
go run [Link]
Test Case:

[Link]
primes&url=[Link]
localhost:8090/odd

Expected Output:
{
"numbers": [1, 2, 3, 5, 7, 8, 9, 11, 13, 15, 17, 19, 21,
23]
}

Problem2:

Develop a HTTP microservice called prefix-management-


service that exposes a GET REST API "/prefixes". This API
receives a query parameter. This query param is called
"keywords".

[Link]

Now, consider we have list of words already present in the


server
[bonfire, cardio, case, character, bonsai]
Your task is to:

1. find if the keywords are found in the server or not


2. if any keyword is found, you need to return the smallest
unique prefix that identifies the keyword
Response of above API call would be like this
[
{
"keyword": "bonfire",
"status": "found",
"prefix": "bonf"
},
{
"keyword": "bool",
"status": "not_found",
"prefix": "not_applicable"
}
]
Please note you can hardcode 20 words in the server for
testing.

Test Case 1:

[Link]

Expected Output:
[
{
"keyword": "bonfire",
"status": "found",
"prefix": "bonf"
},
{
"keyword": "bonsai",
"status": "found",
"prefix": "bons"
}
]

You might also like