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
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess 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
Build my plan
Linked List Coding
00:00
5 left

Linked List Coding

EasyPython

Problem

Zscaler policy-processing code may maintain ordered rule identifiers in a mutable singly linked list. Implement a function that creates the list from initial values and applies a sequence of operations.

The supported operations are:

  1. insert_head, represented as ["insert_head", value]
  2. insert_tail, represented as ["insert_tail", value]
  3. delete, represented as ["delete", value], which removes only the first matching value if it exists
  4. reverse, represented as ["reverse"]

Return the final linked-list contents as a Python list. The linked list must be manipulated with node pointers. Do not use Python list insertion, deletion, or reversal to perform the operations.

Formal Specification

Implement linked_list_operations(values, operations), where values is a list of integers used to construct the initial singly linked list, and operations is a list of valid operation lists. Return a list of integers containing the final node values in order.

Constraints

  • 0 <= len(values) <= 10^4
  • 1 <= len(operations) <= 10^4
  • Values are integers in [-10^9, 10^9]
  • A delete operation removes only the first matching node
  • All operation names and formats are valid

Function Signature

def linked_list_operations(values, operations):
Interviewer

Your question is Linked List Coding. 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.
CodePython 3
Sign up free to run your codeLog inLn 2
Run your code to see test output here.