Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Writing a Function to Solve a Problem

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

Your question is Writing a Function to Solve a Problem. 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

Write a function to solve a concrete problem relevant to Autoscience’s software needs.

Implement deduplicate_values(values) to return a new list containing each value once, preserving the order of its first appearance. The input contains integers, and the output must not modify the input list.

Signature: def deduplicate_values(values):

Input: A list of integers.

Output: A new list of unique integers in first-seen order.

Constraints

  • 0 <= len(values) <= 10^5
  • -10^9 <= values[i] <= 10^9
  • Return a new list and do not modify values
  • Preserve the order of first appearance

Function Signature

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