Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Reverse Array Without rev
00:00
5 left

Reverse Array Without rev

EasyPython

Problem

Write code to reverse an array without using a rev function.

Implement def reverse_array(arr):. The function must reverse the input list in place and return the reversed list. Use only basic array operations and do not call Python's built-in reverse() or create a second array.

Constraints

  • 0 <= arr.length <= 1000
  • -10^9 <= arr[i] <= 10^9
  • The input list must be modified in place
  • Do not call reverse(), reversed(), or any equivalent reverse function

Function Signature

def reverse_array(arr):
Interviewer

Your question is Reverse Array Without rev. 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.
CodePython 3
You need to log in / sign up to run or submit.Ln 2
Run your code to see test output here.