algorithm - How many triangles can be made? -


i have sorted sequence of positive integers. how many triangles can made using these numbers lengths of sides (triangles can not degenerate)? have no idea other checking possibilities.

i have no idea other checking possibilities.

of course check possibilities - after all, required count how many possibilities have. it's matter of how check them. going through sets of thee o(n3), slow.

you can in o(n2*log2n) observing once you've picked 2 sides a , b, can find max length of third 1 binary-searching sorted list position of a+b.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -