We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Maximum Perimeter Triangle
Maximum Perimeter Triangle
Sort by
recency
|
324 Discussions
|
Please Login in order to post a comment
This question can easily be solved by sorting the sticks array but when you are likely to only examine the top few elements in the array, I prefer to use a priority queue for faster run time.
Here is my c++ solution, you can watch the explanation here : https://youtu.be/cP4PLTgC1OE
My Java solution with o(n log n) time complexity and o(1) space complexity:
Here is my Python solution!