Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Automate Log Analysis or Packaging

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

Your question is Automate Log Analysis or Packaging. 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

Call of Duty asset packaging workflows emit chronological records describing assets added to or removed from platform builds. Implement a utility that parses these records and returns the final package manifest efficiently.

Each input record has the format asset|platform|action|size|dependencies, where action is either ADD or REMOVE. For an ADD record, size is an integer number of bytes and dependencies is a comma-separated list of asset IDs, or - when there are no dependencies. For a REMOVE record, size and dependencies are ignored. Records are processed in the order provided.

An ADD for an existing (platform, asset) replaces its previous metadata. A REMOVE deletes that asset from the platform, and is a no-op if the asset is not currently present. Return one dictionary per remaining asset, sorted first by platform and then by asset. Each dictionary must contain platform, asset, size, and dependencies. Dependencies must be unique and sorted lexicographically.

Constraints

  • 1 <= len(records) <= 10^5
  • Each record contains exactly five pipe-separated fields
  • Asset and platform IDs are non-empty and contain no pipe or comma characters
  • 0 <= size <= 10^12
  • All actions and numeric fields are valid

Function Signature

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