Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Get started
Build an API Data App
00:00
5 left

Build an API Data App

MediumPython

Problem

Tell me about how you would create a mobile app that reads and displays data from an API.

Implement the data-preparation portion: deduplicate API records by id, retain the record with the newest published_at, sort records newest first, and return at most limit records.

Signature: prepare_feed(items, limit). Each item is a dictionary with string keys id, title, and ISO-8601 UTC string published_at; return a list of dictionaries.

Constraints

  • 0 <= limit <= 10^5
  • 0 <= len(items) <= 10^5
  • Each item contains string fields id, title, and published_at
  • published_at values use the same ISO-8601 UTC format
  • If duplicate records have equal timestamps, retain the first occurrence

Function Signature

def prepare_feed(items, limit):
Interviewer

Your question is Build an API Data App. Start with the requirements in the Question tab.

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.
Code
Sign up free to run your codeLog inLn 2
Run your code to see test output here.