This question evaluates a candidate's ability to design efficient algorithms for duplicate detection, occurrence counting, and preserving first-occurrence order while reasoning about time and space complexity across in-memory, in-place, and streaming data scenarios.
Given a Python list that can contain integers (possibly negative) and may be very large, write code and explain approaches to find all values that appear more than once, along with their occurrence counts and the index of their first appearance, while preserving the original order of first occurrence. For example, input: [3, 1, 2, 3, -1, 2, 3, 4, 1] → output should enumerate 3 (count 3, first idx 0), 2 (count 2, first idx 2), 1 (count 2, first idx 1) in that order. Then answer: