pathikrit / Quora-Challenges

My solution in Java to the Quora Datacenter cooling challange problem
http://www.quora.com/challenges
4 stars 2 forks source link

Bugs! #1

Open ngokli opened 7 years ago

ngokli commented 7 years ago

Hi Pathikrit!

I decided to revisit this Quora Challenge problem to get back into coding after taking a couple years off for some "personal discovery". One of the problems I'm playing with to get me used to development again before I start interviewing. I stumbled across your repo while trying to find the problem statement (Quora seems to have removed it). My project is in c, but I've used a couple of your optimizations (while wondering if I'd have thought of them myself). Mine is currently two orders of magnitude slower than yours... But I think it may be time to let this go and play with something else.

I have a feeling you aren't going to care about a bug after four years, but... I figured I may as well reach out and say "Howdy!" :)

I was using your code to double-check my results for some new datacenter "maps" I created (while trying to characterize my speedup). I found a couple examples where your code finds no paths but I can manually trace one.

I get 446289 for this one:

8 7
2 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 3 1

and I get 20022 for this one:

8 8
2 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 1
1 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
3 0 0 0 0 0 1 1
pathikrit commented 7 years ago

Hmm, sorry, its been a while... not sure how to help here. But that is indeed surprising since Quora gave me a thumbs up for my submission. Maybe they did not evaluate it well ...

ngokli commented 7 years ago

No worries here!

I just figured I should file an issue since I saw a bug. If nothing else, it may help some poor soul who comes along and tries using this code to check their output :)