Bit Set Problem Statement
You are provided with a string, termed as DIGIT_PATTERN
, which consists solely of digits. The objective is to identify the first digit that repeats in the sequence. If there's no repeating digit, the result should be -1.
Example:
Input:
123456325
Output:
3
Explanation:
In the given string 123456325
, as we move from left to right, digit '3' is the first to repeat, making it our answer.
Constraints:
1 <= T <= 10
1 <= |DIGIT_PATTERN| <= 10^5
0 <= DIGIT_PATTERN[i] <= 9
Note:
You do not need to print anything; just return the answer for each test case.
Be the first one to answer
Add answer anonymously...
Top Grey Orange Software Engineer interview questions & answers
Popular interview questions of Software Engineer
Top HR questions asked in Grey Orange Software Engineer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app