SalesforceOA #3
Bit Pattern (MTS)
Estimated EasyJudge-ready
Topics (AI-labelled)Hashing
For each position, flag whether its value appears at an earlier position and whether it appears at a later position, and return two binary strings. The current position itself does not count as an occurrence.
Input
The first line contains n, followed by n integers. 1≤n≤10000, 0≤num[i]≤10000; the catalog mistakenly merged a line break into 10^40.
Output
The first line holds the earlier-occurrence flags and the second line the later-occurrence flags; each line has exactly n digits.
Example 1
Input:
5
1 2 1 3 2
Output:
00101
11000
Example 2
Input:
1
0
Output:
0
0
Example 3
Input:
3
7 7 7
Output:
011
110
Example notes
Example 1 gives 00101 and 11000; a single element gives 0 on both lines; three 7s give 011 and 110.
Editorial
Loading solution…