Salesforce interview question

Question 1: Bit Pattern Generator ​Short Description: Given an array of integers, determine for each element whether it has appeared previously in the array and whether it will appear again later. Generate two binary strings representing these historical and future occurrences using an efficient hashing approach to achieve O(n) time complexity.