Identify the Non-Twin Person

Problem Overview

  • Determine the smallest number representing a person who is not a twin (appears once); if all are twins, output -1.
  • Input: an integer N followed by N space-separated integers; Output: a single integer per the rule.
  • Context: A survey intended for twins where some non-twins may participate.
  • Source: Asked in Cisco interviews; a common coding interview problem and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: