
Asked in Amdocs
First Unique Character in a String Problem Statement
Given a string STR
consisting of lowercase English letters, identify the first non-repeating character in the string and return it. If no such character exists, return '#'
.
Input:
The first line consists of an integerT
representing the number of test cases.
For each test case, there is a single line consisting of a stringSTR
containing only lowercase English letters.
Output:
For each test case, output the first non-repeating character in the given string.
Output each result on a new line.
Example:
Input:
2
abcab
aabbcc
Output:
c
#
Explanation:
For the first test case, 'c'
is the first non-repeating character in 'abcab'
.
For the second test case, there is no non-repeating character in 'aabbcc'
, hence the output is '#'
.
Constraints:
1 <= T <= 100
1 <= N <= 10^4
Where T
denotes the number of test cases, and N
represents the length of the string. The time limit for each test case process is 1 second.
Note:
No need to print anything; just implement the function to return the result.

AnswerBot
4mo
Identify the first non-repeating character in a given string and return it, or '#' if none exists.
Iterate through the string to count the frequency of each character
Iterate through the string again to...read more
Help your peers!
Add answer anonymously...
Top Associate Software Engineer Interview Questions Asked at Amdocs
Q. Write an SQL query to fetch records and use a join to group three tables.
Q. How do you solve technical problems using recursion?
Q. What is the Collection Framework in Java?
Interview Questions Asked to Associate Software Engineer at Other Companies
Top Skill-Based Questions for Amdocs Associate Software Engineer
C++ Interview Questions and Answers
300 Questions
Data Structures Interview Questions and Answers
250 Questions
Algorithms Interview Questions and Answers
250 Questions
Java Interview Questions and Answers
250 Questions
SQL Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

