Facebook Pixel

How do I build a drag-and-drop list in a machine coding interview?

Use the HTML Drag and Drop API: dragstart (store the dragged item), dragover (prevent default to allow drop), drop (reorder the list). Update the data array and re-render. Add visual feedback (highlight the drop target).

Verify This Answer

Cross-check this information using these trusted sources:

More FAQs in Bonus Machine Coding Questions to Practice

Star rating, todo list with filters, nested comments (Reddit-style), tic-tac-toe, stopwatch, calculator, password strength meter, drag and drop list, tooltip component, and BFS visualizer. Practice these after mastering the common questions.

Recursion (nested comments), game logic (tic-tac-toe), algorithms (BFS visualizer), drag-and-drop API, localStorage persistence, and time-based operations (stopwatch). They test skills beyond the common questions.

Use a tree data structure. Write a recursive render function. Each comment has reply, vote, and collapse handlers. Indent nested comments. Handle reply (add a child), vote (update score), and collapse (toggle children visibility).

Still have questions?

Browse all our FAQs or reach out to our support team

Want to upskill yourself?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.