Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Basic iOS Fundamentals

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

Your question is Basic iOS Fundamentals. 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

Tell me about the basic iOS concepts you rely on when building a new feature. Implement a validator for a simplified UIViewController lifecycle, returning whether an event sequence follows valid transitions. Input is a list of event strings beginning with init; valid events are viewDidLoad, viewWillAppear, viewDidAppear, viewWillDisappear, viewDidDisappear, and deinit. Return True for a valid sequence and False otherwise. For example, ["init", "viewDidLoad", "viewWillAppear"] is valid, while ["init", "viewDidAppear"] is invalid.

Constraints

  • 1 <= events.length <= 10^4
  • Each event is a string from the listed lifecycle events
  • The sequence represents one view controller instance

Function Signature

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