Project Euler: Shortest distance among points

This is my 207th Project Euler problem solved (after problem 100th, it gets really intense). This one, problem 816, seemed on the surface "doable", but required some "guess". The standard brute-force solution would lead to an N^2 algorithm, and since N=2x10^6, became intractable. I then decided to use "some sorting criteria". That gave me an opportunity to, using some heuristics (which I cannot disclose here since Project Euler admins would then lock my account), makes it a more tractable problem. In this case I won't even post the screenshot of the modified code since it will give away pretty easily the heuristic used. But, in case you want to try it, it is a fun problem. Cheers, ACC.




Comments

Popular posts from this blog

Changing the root of a binary tree

ProjectEuler Problem 719 (some hints, but no spoilers)

The Power Sum, a recursive problem by HackerRank