Welcome to LeetCode Discuss.  Please read the FAQ to help yourself making the best use of Discuss.
Ask a Question
Back to Problem

Welcome to LeetCode Discuss.

This is a place to ask questions related to only OJ problems.

Please read the FAQ to help yourself making the best use of Discuss.

Is the input array always sorted ?

0 votes
180 views

Is the input array assumed to always be sorted ?

asked Feb 5 in Subsets by hhk.1989 (190 points)

1 Answer

0 votes

No. There is a test case which is unsorted. I implemented a quick sort.

Does anyone have a better solution without sorting the input?

answered Feb 10 by yongkangliu (200 points)

the result is in non-descending order, so we cant go over sorting part. so sorting input is the most efficient way.


...