- Google Chrome
- Visual Studio Code (VS Code)
- Live Server Extension for VS Code
Note: The following is a screenshot of the Live Server Extension.
version: '3.1' | |
services: | |
db: | |
image: mysql:latest | |
command: --default-authentication-plugin=mysql_native_password | |
volumes: | |
- mysql_data:/var/lib/mysql | |
restart: "no" # 'always' would start this service each time my machine is powered on | |
ports: |
const fibonacci_memo = () => { | |
const memo = {}; | |
const fibonacci = (n) => { | |
if (n in memo) { | |
return memo[n]; | |
} else if (n === 0) { | |
return 0; | |
} else if (n <= 2) { | |
return 1; |
const fib = (n) => { | |
if (n === 0) { | |
return 0; | |
} else if (n <= 2) { | |
return 1; | |
} | |
return fib(n - 1) + fib(n - 2); | |
}; |
// returns formatted time in minutes and seconds as a string | |
const formattedTime = (timeInMilliseconds) => { | |
const time = timeInMilliseconds; | |
let timeStr = ""; | |
const minutes = Math.floor(time / 60000); | |
const seconds = (time % 60000) / 1000; | |
return `${ minutes } minutes and ${ seconds } seconds`; |
// An example of a valid parameter is Date.now() | |
const timer = (startTimeInMilliseconds) => { | |
const startTime = parseFloat(startTimeInMilliseconds); | |
return (endTimeInMilliseconds) => { | |
const endTime = parseFloat(endTimeInMilliseconds); | |
return endTime - startTime; | |
}; | |
}; |