Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Array Max From Position

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

Your question is Array Max From Position. 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

The ANZ mobile app may need to inspect a portion of an event or transaction-value list beginning at a specified position. Given an integer array and a valid starting index, return the maximum element from that index through the end of the array.

The starting element is included in the search. Do not modify the input array.

Formal Specification

Implement max_from_position(nums, start):

  • Input: nums, a non-empty list of integers, and start, an integer index.
  • Output: The largest integer in the inclusive range nums[start:].
  • Return type: Integer.

Constraints

  • 1 <= len(nums) <= 10^5
  • 0 <= start < len(nums)
  • -10^9 <= nums[i] <= 10^9
  • The input array must remain unchanged

Function Signature

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