Coding questions (solve both)
1) First non-repeating character
Given a string s, return the first character that appears exactly once in the string.
-
If no such character exists, return an empty value (e.g.,
""
) or a special marker such as
None
/
null
.
Input: s (string)
Output: the first non-repeating character (or empty marker)
Constraints (typical):
-
1 <= len(s) <= 10^5
-
s
may contain letters (assume ASCII unless stated otherwise)
2) Best average score
You are given a list of score records. Each record contains a name (string) and a score (integer).
Return the highest average score among all names.
-
A person may appear multiple times; their average is the mean of their scores.
-
You may assume each person has at least one score.
-
Specify how you handle rounding (e.g., return a floating-point number, or return an exact rational/decimal).
Input: records = [(name1, score1), (name2, score2), ...]
Output: the maximum average across names
Constraints (typical):
-
1 <= len(records) <= 10^5
-
score
can be negative or positive (state assumption if you restrict it)