Thank you for participating in our coding challenge! Your goal is to build a small full-stack application using React + TypeScript on the frontend and Node.js + Express on the backend. The total time for this challenge is 1 hour ( 60 minutes ).
Please follow all requirements and submission instructions below.
You will build:
-
A backend API proxy that fetches users from a public API
-
A frontend interface that displays, filters, and interacts with those users
Base URL
http://localhost:3000
Endpoint: GET /api/users
This endpoint must:
-
Fetch users from
https://jsonplaceholder.typicode.com/users -
Include basic error handling
-
Return the JSON data to your frontend
GET /api/search?q=<term>
This endpoint must:
a. Implement Levenshtein distance from scratch (no external distance libraries). See Annexure at the end
b. For each user, compute similarity between:
-
search term
-
user.name
c. Sort results by similarity (descending)
d. Return the top 5 matches
e. Performance requirements:
-
Must compute a single query in < 50ms on average
-
Use optimized DP (O(min(m, n)) space)
f. Include at least 3 unit tests:
-
perfect match
-
1 edit distance
-
no similarity
The frontend must fetch data only from your backend:
GET http://localhost:3000/api/users
Display all users showing:
- Name
- Company name
Add a search box that:
- Filters by name
- Uses a 300ms debounce
- Updates on the client side
Add a "Favorites Only" toggle.
When a user is clicked, show their details on the right side:
- Name
- Phone
- Clicking ⭐ toggles favorite status
- Must not trigger the details panel
- Favorites stored only in React state
/backend → Express server
/frontend → React + TypeScript
cd backend
npm install
npm run dev
cd frontend
npm install
npm run dev
- Push code to GitHub
- Deploy via Vercel
- Ensure auto-deploy on push
- Total time: 1 hour (60 mins)
- Submit:
- GitHub repo link
- Live Vercel link
- Push code to GitHub
- Deploy via Vercel
- Ensure auto-deploy on push
- Submit:
- GitHub repo link
- Live Vercel link
The Levenshtein distance is the minimum number of single-character edits required to transform one string into another.
Allowed operations:
- Insertion
- Deletion
- Substitution
Transforming "kitten" → "sitting" requires 3 steps:
- kitten → sitten (substitute k → s)
- sitten → sittin (substitute e → i)
- sittin → sitting (insert g)
Therefore:
distance("kitten", "sitting") = 3
Given two strings a (length m) and b (length n), the Levenshtein distance d(m, n) is defined recursively:
If min(m, n) = 0:
distance = max(m, n)
Otherwise:
d(i, j) = min(
d(i-1, j) + 1, // deletion
d(i, j-1) + 1, // insertion
d(i-1, j-1) + cost // substitution
)
Where cost is: 0 if a[i] == b[j] 1 otherwise
- Time: O(m × n)
- Space: O(m × n)
- Space: O(min(m, n))
Good luck!