FastPrepGenerate Seen Binary Strings
Problems/Generate Seen Binary Strings

Generate Seen Binary Strings

Salesforce logoSalesforce● EasyOA

Updated May 2026

QuestionFunctionExamples

Problem statement

You are given an integer array arr. Return two binary strings of length arr.length:

  1. The first string has 1 at index i if arr[i] appears anywhere after index i; otherwise it has 0.
  2. The second string has 1 at index i if arr[i] appears anywhere before index i; otherwise it has 0.

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 Online Assessment questions

  • Count Subarrays With Product Equal to KOA · Seen Dec 2026
  • Get Minimum TimeOA · Seen Nov 2026
  • Minimum No-Repeat Segments After One Character RemovalOA · Seen Nov 2026
  • Get Message StatusOA · Seen Nov 2026
  • Minimum Unique-Character Segments After DeletionOA · Seen Sep 2026
  • Run-Length String CompressionOA · Seen Sep 2026
  • Maximum Requests in WindowOA · Seen Sep 2026
  • Final Pod Counts After LogsOA · Seen Aug 2026
  • Minimum Removals to Balance ArrayOA · Seen Aug 2026
  • Is This Date a Weekend?OA · Seen Aug 2026

Similar questions at other companies

  • Build the Task HierarchyPendo · OA
  • Macaron Order with Set DiscountsShopify · OAShopify interview questions
  • 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

Salesforce interview experiences

  • Salesforce Infrastructure SWE OA and Onsite: 1 Experience
  • Salesforce Experienced Backend SWE First Round: 1 Experience
All Salesforce interview questionsSee Salesforce hiring insights
Saved
class Solution {
    public String[] generateSeenBinaryStrings(int[] arr) {
      // write your code here
    }
}
Checking account…