Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Reverse Volvo Cars App String

Volvo CarsEasyPython00:00
Volvo Cars
Your interviewer · Mobile Engineer
In session
Interviewer

Welcome to the Python screen for the Mobile Engineer role at Volvo Cars.

The question is on your right: Reverse Volvo Cars App String. Read through the requirements first.

Would you like to talk through your approach, or are you ready to start coding?

Talking through your plan before coding is graded well.

Problem

In the Volvo Cars app, some UI utilities need to transform text before display. Write a function that takes a string s and returns a new string with its characters in reverse order.

Formal Specification

  • Input: a string s
  • Output: a string containing the characters of s in reverse order
  • Do not use Python's built-in reverse helpers such as slicing with [::-1] or reversed().

Constraints

  • 0 <= len(s) <= 10^5
  • s may contain letters, digits, spaces, and punctuation
  • Do not use Python slicing with [::-1] or reversed()
  • Return a new string

Function Signature

def reverse_string(s):
Your solutionPython 3
Run as often as you like, then submit when the output looks right.
Run your code to see test output