3 ms·
> Most books on algorithms will have the solution. What would you call this algorithm? I solved the second problem, but my solution is brute-force, and I'd li
by georgieporgie 16y ago
> Most books on algorithms will have the solution.
What would you call this algorithm?
I solved the second problem, but my solution is brute-force, and I'd like to see a better way to do it.
- igoros 16y agoAnswer in rot13: Gur grpuavdhr vf pnyyrq "qlanzvp cebtenzzvat". Naq, guvf cnegvphyne ceboyrz vf pnyyrq gur "pbva punatr ceboyrz".
- georgieporgie 16y agoGreat, thanks!
- leif 16y agolbh pna whfg guvax bs vg nf onpxgenpxvat naq zrzbvmr lbhe shapgvba yngre qnfu guvf fubhyq or rdhvinyrag gb gur qc bcra cnera ohg v unirag pbzcyrgryl jbexrq bhg gur qc fb znlor abg dhrfgvba znex pybfr cnera
- deleted 16y ago[deleted]
- rflrob 16y agoI'm not convinced that brute force is such a bad approach, as long as a) you start with the greedy approximation, and b) stop once you know you're doing worse than the greedy approximation. My python brute-force solution runs in .035 s.
- georgieporgie 16y agoMy brute force algorithm runs in about two minutes... It's C++. I'm sure you can see why I'm so interested in better solutions. :-)