Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Debug a Technical Issue

MediumPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Debug a Technical Issue. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Describe a scenario where you solved a technical issue by debugging code. As a coding follow-up, inspect the duplicate-detection behavior and implement the corrected function. Given a list of values, return the indices of the first value whose second occurrence is encountered, or [-1, -1] when every value is unique. For example, [4, 1, 4] returns [0, 2], while [2, 3] returns [-1, -1].

Constraints

  • 0 <= values.length <= 1000
  • Values may be positive, zero, or negative integers
  • Return the pair for the earliest second occurrence
  • Return [-1, -1] when all values are unique

Function Signature

def first_duplicate_indices(values):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output