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

Advent of Code - Day 6, 2024: BFS and FSM

Golang vs. C#: performance characteristics (simple case study)

Advent of Code - Day 7, 2024: Backtracking and Eval