Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Max Value in Array

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

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

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):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output