TikTokRole: Backend Software EngineerSeptember 2026
Interview question
Implement the backend logic for a simplified notes app. A POST /notes request creates and saves a text note. Decide what data the client needs to send and what the server should return. Use an in-memory store rather than a real database initially; the provided Java store is final class Notes extends HashMap<String, Note> {}. Implement createNote(Map<String, String> body), with Note holding its identifier and text body. Networking and a real HTTP server are not required.
Follow-up questions
- Add the Note constructor and declare the fields it initializes.
- Implement a method that returns all stored notes so the app can display them.
- Which HTTP methods should clients use to create a note and list all notes?
- What happens to notes held in the in-memory store when the server restarts?
- How would you change the program to persist notes in a database, and would you choose SQL or NoSQL?
- Write the SQL statement to store a note in a notes table.
- Write the SQL query for the endpoint that retrieves all notes.
- Give an example of how a server could successfully write a note and send its response while the phone never receives that response.
- What happens if the client times out and sends the same create request again? How would you prevent duplicate notes?
- Explain in detail how your approach detects a retried request, and show the SQL that implements it.
- How would the system identify the note itself separately from the request that created it, and where would the note identifier be assigned?