SoftwareTestPilot
LearnCoding RoundsCommunityJobsQA Resources
All questions
BasicJavaScript~7 min

Find duplicate elements in an array

Common in SDET and automation tester screening

Points available

100/100

Your mission

  1. Read
  2. 2Run
  3. 3Submit
  4. 4Solve

Write findDuplicates(arr) that returns an array of values that appear more than once.

Each duplicate should appear once in the result, in the order it was first repeated.

Examples

findDuplicates([1, 2, 3, 2, 4, 1]) → [2, 1]

Hints

Each hint costs 10 points on a full solve.

Interviewer follow-ups

  • What is the complexity with and without a Set?
  • How would you find duplicate test IDs in a test report?

Ctrl+Enter to run · add Shift to submit

1
2
3
4
Tab inserts two spaces. Press Escape, then Tab, to leave the editor.
Terminal

$ node solution.js

Run executes the open file. Submit scores solution.js against hidden tests.

SoftwareTestPilot

Learn QA, prove your skills, connect with testers and grow your career.

Platform
  • Learn
  • Community
  • Jobs
Resources
  • QA Resources
  • Interview Questions
  • QA Tools
  • Articles
  • Products
Company
  • About
  • Contact
  • Authors & Reviewers
  • Editorial Policy
  • Sitemap
© 2026 SoftwareTestPilot. All rights reserved.
Operated by SoftwareTestPilot · Pune, Maharashtra, India · softwaretestingsapiens@gmail.com
PrivacyTermsCookiesDisclaimerRefundsAccessibility