Diff Max Min Problem

Diff Max Min Problem — ExecCode School DSA Practice

Solve the Diff Max Min problem on ExecCode. Free online school DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

You are given a list of whole numbers. Your task is to solve Diff Max Min. Find the largest and the smallest numbers, subtract the smallest from the largest, and print the difference.

Examples

Input 5 1 2 3 4 5; Output 4. Input 3 10 5 1; Output 9

Constraints

1 <= N <= 1000

Practice Diff Max Min free on ExecCode. Browse DSA problems, topic map, and placement guides.