Use sorting x, use quick select algorithm x
Input: n = 5, 1 2 6 7 0 Output: 84 I used Quick Select to get it They say you should not use Quick Select.
python
I don't know if I'm making it too simple, but....
I hope it's a hint. Give that a try.
© 2024 OneMinuteCode. All rights reserved.