Grokking Microsoft Coding Interview
Ask Author
Back to course home

0% completed

Vote For New Content
O(n) solution

zerochen231

Jun 22, 2024

Sorting is n*log(n), we can pass through the array twice to get the two smallest prices.

0

0

Comments
Comments
S
sujay.gunjal a year ago

We can use two variables and make a one pass to get the solution no need to do two passes.

On this page