TikTok Interview Coding Question: Fetch and Render Questions

19 Views
No Comments

Fetch and Render Questions

Question description

There is an API that can return question data:

https://664353ed6c6a6565870698da.mockapi.io/api/test/questions

Response data:

[
  {
    id: "sign-up-form",
    name: "Sign-Up Form",
    category: "HTML"
  },
  ...
]

Then we have another API:

https://664353ed6c6a6565870698da.mockapi.io/api/test/submissions

Return data like this:

[
  {
    questionId: "Sign-Up Form",
    status: "CORRECT"
  },
  {
    questionId: "throttle",
    status: "INCORRECT"
  }
]

Requirements:

  • Render the questions by different group.
  • Show every group’s totalCount and correctCount.

Example:

HTML (2/4): Sign-Up Form, Div Tags

This problem asks you to fetch questions and submission results, group the questions by category, and display each group with its total count and correct count. A typical solution uses a hash map to organize questions by category, then another lookup to determine whether each question was answered correctly based on the submissions data. Finally, you render each category in the required format, such as HTML (2/4).

END
 0