https://github.com/johnnybui/johnny-bui
https://github.com/johnnybui/johnny-bui
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/johnnybui/johnny-bui
- Owner: johnnybui
- Created: 2024-04-05T03:42:53.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-04-08T08:18:50.000Z (over 1 year ago)
- Last Synced: 2025-02-01T02:19:52.411Z (9 months ago)
- Language: TypeScript
- Size: 165 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Code Challenge For Backend
### Preparation
```npm install```
### Problem 4
- Run the app to see result
```npm run prob4 ```
#### Comments on the functions:
- Closed-form Formula: This implementation is simple and fastest to run since it computes the sum directly. Runtime: Constant.
- Iterative Approach: This implementation is the easiest to understand since it iterates from 1 to n once. However it is significant slower than the previous because of the loop of sums. Runtime: Linear.
- Recursive Approach: This implementation use recursion to calculate the sum. It is simple but consume more memory due to recursive calls and there's a risk of stack overflow for large values of n. Runtime: Linear.The most efficient approach is the Closed-form Formula.
### Problem 5
Stack I use for this backend include: ExpressJS (TypeScript), Prisma, Swagger, SQLite.
Please run in steps:
- Migrate the local database
```npm run prisma:migrate```
- Seed data
```npm run prisma:seed```
- Run the backend app
```npm run prob5```
- Open http://localhost:3000/api-docs to use and test the server API directly.
### Problem 6
Refer to [Problem 6 README](src/problem6/README.md)