FastPrepRemove Duplicates from a List
Problems/Remove Duplicates from a List

Remove Duplicates from a List

Bank of America logoBank of America● EasyNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported by a Bank of America new grad from a campus drive, as the second coding task in a recorded video interview, followed by a recorded explanation of the code. The task was to take a list in which values repeat and give back each value only once.

The report gives no examples or limits, and it does not say whether the order of the values matters. Here, the list is an integer array of up to 5,000 values, and each value is kept at the place it first appears.

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

Given an integer array nums in which some values may appear more than once, return a new array that holds every distinct value of nums exactly once.

Keep the values in the order of their first appearance in nums.

Function

uniqueList(nums: int[]) → int[]

Examples

Example 1

nums = [8,3,8,5,3,3,1]return = [8,3,5,1]

The values first appear in the order 8, 3, 5, 1. The second 8 and the second and third 3 are copies of values already kept, so they are left out.

Example 2

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

All three entries hold the same value, so it is kept once.

Example 3

nums = [4,0,-7,9]return = [4,0,-7,9]

No value repeats, so every value is kept, in the same order.

Constraints

  • 1 <= nums.length <= 5000
  • -10^4 <= nums[i] <= 10^4

More Bank of America Online Assessment questions

  • Return Exact Cash Register ChangeOA · Seen Aug 2026
  • Sum Skipping Multiples of 7OA · Seen Nov 2025
  • Wildcard Substring MatchOA · Seen Nov 2025
  • Maximum String BeautyOA · Seen Sep 2024
  • Merge Point of Two Linked ListsOA · Seen Oct 2023
  • Pairs with Target Sum in a Sorted ArrayOA · Seen Oct 2023
  • Count Level-Order Traversals of a TreeOA · Seen Sep 2023
  • Count Set BitsOA · Seen Sep 2023
  • Count Pairs with Sum KOA · Seen Jun 2023
  • Letter Pattern SumOA · Seen Sep 2022

Similar questions at other companies

  • Count User Mentions in Chat MessagesRamp · OARamp interview questions
  • Count Valid Square PairsAuxoAI · OA
  • Two SumAmazon · OA · PHONE SCREEN
  • Find Words That Can Be Formed by CharactersTabaPay · OA
  • Basic Item DiscountsPalantir · OAPalantir interview questions
  • Word Frequency Counts in Alphabetical OrderAbridge · OAAbridge interview questions
  • Customer Signer ScreeningState Farm · OA
  • Minimum Magic Stones After MergesElevenLabs · OAElevenLabs interview questions
  • K Most Recent Unique Request IDsMicrosoft · OAMicrosoft interview questions
  • Distinct Products After Removing One ElementHSBC · OAHSBC interview questions

Bank of America interview experiences

  • Bank of America interviews · December 2025
  • Bank of America OA · December 2025
  • Bank of America interviews · September 2026
  • Bank of America OA · September 2026
All Bank of America interview questionsSee Bank of America hiring insights
Saved
class Solution {
    public int[] uniqueList(int[] nums) {
        // write your code here
    }
}
Checking account…