Validate sorted input or fail fast

Java Hard 6 views
Back to Questions

Problem Description

Task: if array is not sorted, throw IllegalStateException. Else return true.

Input Format

Java method

Output Format

Return value

Constraints

O(n) validation.

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next