CLASSMONITOR - Editorial

Practice

Author: amul agrawal

DIFFICULTY:

MEDIUM

EXPLANATION:

The algorithm itself is incorrect. We can hack this solution with a simple hack case like

4
2 3 6 8

The wrong answer code will make 3 lines 2 6 , 3 and 8.
The correct solution should make 2 lines 2 8 and 3 6.

1 Like