Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 1.45 KB

README.md

File metadata and controls

28 lines (22 loc) · 1.45 KB

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