You are given two separate coding tasks.
Given a string s (lowercase/ASCII letters), return the index of the first character that appears exactly once in the string. If no such character exists, return -1.
Input: s (string)
Output: integer index (0-based) or -1
Examples
s = "leetcode"
→
0
(character
'l'
)
s = "loveleetcode"
→
2
(character
'v'
)
s = "aabb"
→
-1
You are given a list of student score records. Each record contains a student_id (string) and a score (integer). A student can appear multiple times.
Compute the average score per student (mean of all that student’s scores), and return the maximum average across all students.
Input: list of pairs [(student_id, score), ...]
Output: the highest average (as a floating-point value or as an exact rational; specify your choice during the interview)
Example
Input: [("a", 80), ("b", 90), ("a", 100)]
90
Notes / Clarifications to ask: