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
Design Patterns You Used
00:00
5 left

Design Patterns You Used

MediumPython

Problem

Can you explain the design patterns you have worked on?

Asked in the Technical stage. Logged as the Technical question of a Citi Solutions Architect interview on 13 Jan 2021.

To demonstrate your answer in code, implement a configurable formatter using the Strategy and Factory patterns. Given a list of messages and a formatter name, return the formatted messages.

Function

format_messages(messages, formatter) returns a list of strings. Supported formatters are plain, upper, and bracket.

Constraints

  • 0 <= len(messages) <= 10^4
  • Each message is a string.
  • The formatter is one of "plain", "upper", or "bracket".

Function Signature

def format_messages(messages, formatter):
Interviewer

Your question is Design Patterns You Used. 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.