Generate Seen Binary Strings
Updated
Problem 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 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