Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Max Value in Array
00:00
5 left

Max Value in Array

EasyPython

Problem

Write a function that returns the maximum value in an array of integers. The array may contain negative numbers, duplicates, and zero.

Formal Specification

  • Input: A list of integers nums
  • Output: A single integer, the largest value in nums
  • Assume nums is non-empty.

Constraints

  • 1 <= len(nums) <= 10^5
  • -10^9 <= nums[i] <= 10^9
  • nums is non-empty

Function Signature

def find_max(nums):
Interviewer

Your question is Max Value in Array. 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.