Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Largest Among Three Numbers

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

Your question is Largest Among Three Numbers. 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

As part of a Revature coding assessment, write a function that returns the largest value among three integers. The values may be positive, negative, or equal.

Formal Specification

Implement largest_of_three(a, b, c):

  1. Input: Three integers a, b, and c.
  2. Output: The largest integer among the three inputs.
  3. If two or more values are equal and largest, return that shared value.

Do not sort the values, since only the maximum is required.

Constraints

  • -10^9 <= a, b, c <= 10^9
  • Inputs are valid integers
  • Return the largest input value
  • Use O(1) extra space

Function Signature

def largest_of_three(a, b, c):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output