Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Android Domain and Coding

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

Your question is Android Domain and Coding. 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

Explain the Android domain concepts and programming challenges you expect to handle in a mobile engineering interview.

For the coding portion, implement a validator for an Android Activity callback sequence. Return True only when every callback follows the simplified lifecycle transition rules below. The function accepts a list of callback names and returns a Boolean.

onCreate starts the Activity. Valid transitions are onCreate to onStart or onDestroy, onStart to onResume or onStop, onResume to onPause, onPause to onResume or onStop, and onStop to onRestart or onDestroy. onRestart must transition to onStart; onDestroy is terminal.

Constraints

  • 0 <= events.length <= 10^4
  • Each event is a string
  • Recognized callbacks are onCreate, onStart, onResume, onPause, onStop, onRestart, and onDestroy
  • The empty sequence is invalid
  • An Activity instance cannot transition after onDestroy

Function Signature

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