A Simple Maximum

View as PDF

Submit solution

Time limit:0.2s
Memory limit:1M

Problem type

Allowed languages

Your computer engineering instructor gave you a simple task:

Write a program to find the largest number in a list of N signed 8-bit integers.

Since you think this is too easy a task for your programming prowess, you've decided to make life more interesting... by computing this simple maximum in assembly. To top things off, you want to show off by also finding the minimum number in the list.

Input Specification

The first line of input will contain the integer N (1 \le N \le 100).
The second line of input will contain N space-separated signed 8-bit integers, representing the list.

Output Specification

The minimum number in the list followed by the maximum, and separated by a space.

Sample Input

2 3 9 0 18

Sample Output

0 18


To use libc in NASM, the first line of your program should be ; libc. For all others, it should be ; features: libc.

Language Constraints

Because Assembly (ARM) runs under qemu, it is allocated 0.5s and 4096kb of RAM.


  • 0
     commented on Sept. 25, 2016, 10:42 a.m.

    Please make it clear whether these are signed or unsigned. I'll assume unsigned for now.

    • 2
       commented on Sept. 25, 2016, 10:49 a.m.

      They are signed, and I've updated the statement to reflect this.