kilian-hu / hackerrank-solutions

A collection of solutions to competitive programming exercises on HackerRank.
https://www.hackerrank.com/0xC0FFEE64
403 stars 176 forks source link

sorted-sums (less complex) #2

Closed back-2-hack closed 1 year ago

back-2-hack commented 2 years ago

Yup, this is a verified code !

kilian-hu commented 2 years ago

Hi @back-2-hack

Thank you very much for the PR :)

After a quick look at your changes, I think your solution will get timeouts, since it looks like a O(n^2) solution to me, while the one I have is O(n log n). Did your solution pass all the test cases from the certification exam?

back-2-hack commented 2 years ago

Yes it passed all the test cases from exam !

kilian-hu commented 1 year ago

Hi @back-2-hack,

I had another look at your PR and I agree that the code correctly solves the problem, but it actually has O(n^2 log(n)) complexity while the current solution has O(n log(n)) complexity.

So I'll close this PR, but still thank you for your contribution :)

Cheers