3 ms·
> the output requested isn't quoted. Input: "aaaabbbcca" Output: [("a", 4), ("b", 3), ("c", 2), ("a", 1)] The input and output is explicit. The interpretatio
by Supermancho 6y ago
> the output requested isn't quoted.
Input: "aaaabbbcca"
Output: [("a", 4), ("b", 3), ("c", 2), ("a", 1)]
The input and output is explicit. The interpretation is a talking point.
Serialization into parens is not native for most? scripting languages. Creating a string would probably be most efficient for the output format, for sure. It's important to remember that interview questions are not just about the algorithm (for which this is trivial) but the requirements. Asking if the double quotes are representing strings (and what kind of strings for some languages) is part of the natural back-and-forth of an interview.