Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

any recommendations on how to do this?




One way I've found is to break the problem down, and think about each step in reverse. So for example, what does the final stage want to do in order to achieve the result in a simple way? It might be that to get the final result it needs to sum numbers, but also needs to know their matching index in another array, plus some other identifier you got from an as-yet-unwritten previous step. This means your final stage needs a bunch of records that are (number, idx, sourceId), which means the step before needs to construct them - what information does it need to transform into that?

Write the simple code you want to write, and think about what makes the prior step possible in the easiest way and build your structures from there, filling in the gaps.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: