020-005-004

Collections: List Sorting and Shuffling

Hard

Problem Description

Collections: List Sorting and Shuffling

Learning Objective: Master Collections utility class methods: sort, reverse, max

Perform operations on number list using Collections class methods.

Input

Line 1: Number of elements
Line 2: Space-separated integers
Line 3: Operation ("sort", "reverse", "max", "min")

Output

Sort: Sorted list
Reverse: Reversed list
Max: Maximum value
Min: Minimum value

Example

Input:

5
3 1 4 1 5
sort
```java
Output:
```java
[1, 1, 3, 4, 5]

Test Cases

※ Output examples follow programming industry standards

Input:
5
3 1 4 1 5
sort
Expected Output:
[1, 1, 3, 4, 5]
Input:
4
1 2 3 4
reverse
Expected Output:
[4, 3, 2, 1]
Input:
5
10 20 5 30 15
max
Expected Output:
30
Input:
3
100 50 75
min
Expected Output:
50
❌ Some tests failed
❌ エラー発生

Your Solution

Current Mode: My Code
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here

sc.close();
}
}
0 B / 5 MB

You have 9 free executions remaining