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
Coding: String and Lists
00:00
5 left

Coding: String and Lists

EasyPython

Problem

Sony BRAVIA test tooling receives a label string and a sequence of integer measurements. Implement a function that performs four deterministic transformations without changing the original list.

Requirements

  1. Reverse the input string by Unicode code point.
  2. Count ordinary ASCII space characters, " ", in the original string. Do not count tabs or newlines.
  3. Replace every consecutive run of two or more ordinary spaces with exactly one space. Single spaces remain unchanged, and other whitespace is preserved.
  4. Split the integer list into two stable lists: values at even positions first and values at odd positions second. Preserve the relative order within both lists. Position counting is zero-based, and the value itself may be negative or odd/even independently of its position.

Return a dictionary with exactly these keys: reversed, space_count, normalized, even_positions, and odd_positions.

Formal Specification

Input is text: str and values: list[int]. Return dict containing a string, an integer, a string, and two integer lists. The input list must not be mutated.

Constraints

  • 0 <= len(text) <= 10^6
  • 0 <= len(values) <= 10^6
  • -10^9 <= values[i] <= 10^9
  • Only the ASCII space character is counted or normalized
  • The input list must not be mutated

Function Signature

def process_bravia_data(text, values):
Interviewer

Your question is Coding: String and Lists. 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.