FastPrepValues That Appear Twice
Problems/Values That Appear Twice

Values That Appear Twice

Adobe logoAdobe● MediumFULLTIMEINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: This problem lists the values that occur twice in an array whose values run from 1 to its length. Two Adobe reports ask for duplicates in an array. One post on an on-campus internship (posted November 2023) gives the fuller version. In the interview that followed the resume screen and an online test, one of its four data structure questions is this task. The values that occur twice are to be printed, for an array of the numbers 1 to n where each value occurs once or twice. The other is an entry for a technical manager role in India (a copy of a review, interview on 4 June 2022, no offer). Among four short coding prompts, it lists one about finding the repeated values of an array, with no value range or other details.

The 1 to n range and the at-most-twice rule come from the first report only. For the second report they are our reading. Our other choices: values may also be missing. The values are returned as a list in increasing order instead of printed. Arrays have up to 10^4 values. The examples are new. We check only the returned list, so extra memory is allowed. The editorial also shows a method that uses constant extra space.

Our version is about 85% the same as the reported questions.

You are given an array nums of length n. Every value is between 1 and n, and each value appears once, twice, or not at all.

Return the values that appear exactly twice, in increasing order. If no value appears twice, return an empty list.

Function

findTwice(nums: int[]) → List<Integer>

Examples

Example 1

nums = [3,1,3,2,6,1]return = [1,3]

There are 6 values, each from 1 to 6. The value 3 appears at positions 0 and 2, and 1 at positions 1 and 5; 2 and 6 appear once, and 4 and 5 not at all. In increasing order the answer is [1,3].

Example 2

nums = [2,1]return = []

Both values appear once (n = 2, values 1 and 2), so nothing appears twice: [].

Example 3

nums = [2,2]return = [2]

Both values are 2, so 2 appears twice: [2].

Constraints

  • 1 <= n == nums.length <= 10^4
  • 1 <= nums[i] <= n
  • Each value appears at most twice

More Adobe Phone Screen questions

  • Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
  • Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
  • Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
  • Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
  • Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 2026

Similar questions at other companies

  • Insert Delete GetRandom O(1)Charta Health · PHONE SCREENCharta Health interview questions
  • Filter, Sort, and Deduplicate Scheduled TasksRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
  • Longest Consecutive SequenceKotak Mahindra Bank · PHONE SCREENKotak Mahindra Bank interview questions
  • Longest Consecutive SequenceJP Morgan Chase · PHONE SCREENJP Morgan Chase interview questions
  • Linked Merchants Within Two HopsStripe · PHONE SCREENStripe interview questions
  • Logger Rate Limiter with Every-Arrival HistoryGoogle · PHONE SCREENGoogle interview questions
  • Propagating Fraud DetectorAffirm · PHONE SCREEN · ONSITE INTERVIEWAffirm interview questions
  • Top K Frequent Elements with a Recency TiebreakSwiggy · PHONE SCREEN
  • Order and Batch Open-Close LifecycleHudson River Trading · PHONE SCREENHudson River Trading interview questions
  • Pins Violation Log QueriesPinterest · PHONE SCREENPinterest interview questions

Interview reports that mention this question

  • Adobe SWE Intern Interviews: 27 Experiences (Part 2 of 4)
  • Adobe Intern Interview Questions: 54 Experiences (Part 1 of 4)
  • Adobe Frontend and QA Interviews: 14 Experiences (Part 6 of 6)

Adobe interview experiences

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public List<Integer> findTwice(int[] nums) {
        // Write your code here.
    }
}
Checking account…