Problem · Array
Generate Seen Binary Strings
Learn this problemProblem statement
You are given an integer array arr. Return two binary strings of length arr.length:
- The first string has
1at indexiifarr[i]appears anywhere after indexi; otherwise it has0. - The second string has
1at indexiifarr[i]appears anywhere before indexi; otherwise it has0.
Function
generateSeenBinaryStrings(arr: int[]) → String[]Examples
Example 1
arr = [1,2,3,1,2,4,5]return = ["1100000","0001100"]The first two values appear again later, so the first string starts with 11. The values at indices 3 and 4 appeared earlier, so the second string has 1 at those positions.
More Salesforce problems
- Minimize Total Input Cost (for LTMS)Seen Jun 2026
- Count Prime StringsONSITE INTERVIEW · Seen Jun 2026
- Final Pod Counts After LogsOA · Seen May 2026
- ATM Queue Exit OrderPHONE SCREEN · Seen May 2026
- Good Ways to Split an ArrayPHONE SCREEN · Seen May 2026
- Update Pod Counts From LogsOA · Seen May 2026
- Minimum Removals to Balance ArrayOA · Seen May 2026
- Key Teams in TreeOA · Seen Mar 2026