Back to problems

Array Left / Right Duplicate Check (Binary Strings)

Algorithm · Salesforce · Easy

Requirements Given an integer array nums containing n elements. Return [string1, string2], where both entries are binary strings: Put '1' at string1[i] when nums[i] has occurred somewhere before position i; otherwise put '0'. Put '1' at string2[i] when the same value occurs somewhere after position i; otherwise put '0'. Examples Notes Important boundary cases: when n = 1, return "0", "0". If every number is unique, both strings contain only 0s. If all values are identical,…

Checking your access…