Skip to content

A rest endpoint that process the input ands turns it into a magic number.

Notifications You must be signed in to change notification settings

jvega48/flask-magic-number-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

flask-magic-number-app

A REST endpoint that process a number input and turns it into a magic number efficiently.

Coding Challenge

Look at the pseudocode below. specialMath(7) returns 79. specialMath(17) returns 10926. This question has two parts: first, implement it in Python, ensuring someone can call it through a REST endpoint (e.g. $> curl http://127.0.0.1:5000/specialmath/7); second, have the endpoint calculate for an input of 90. You can use frameworks such as Django and Flask if you like.

function specialMath(int n) {
	if(n==0) return 0
	else if(n==1) return 1
	else return n + specialMath(n-1) + specialMath(n-2)
}

How To Test The Endpoint

Make sure flask and python is installed before running the command

python -m flask run

Output For Test Cases

7 17 90 100

Screen Shot 2021-11-11 at 6 45 51 PM

Screen Shot 2021-11-11 at 6 46 10 PM

Screen Shot 2021-11-11 at 6 46 22 PM

Screen Shot 2021-11-11 at 6 46 34 PM

About

A rest endpoint that process the input ands turns it into a magic number.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages