3 ms·
5 programming problems every Software Engineer should be able to solve
- Someone 11y agoFor software engineering problems, it surprises me that he puts #5 after #4. For #5, it is almost immediately clear that brute-forcing it will work (there are 3^8 solutions to place pluses, minuses, and 'nothings' between those nine digits. That is 81^2, way less than 10000) #4, on the other hand, may have an input with a million integers that would probably make that Java solution, with all its toString calls _and_ string concatenations inside the comparison function that will get called in the ballpark of a billion times, slow down to a crawl. That's why the proposed solution to #4 is not that of a software _engineer_. An engineer would convert those integers to strings only once. He might keep the concatenations around because they aren't shown to be problematic yet.
- svpino 11y agoThey are not supposed to be in any order.
- user12340987 11y ago#4 and #5 are definitively harder than they look.
- flaie 11y agoI took a chance and wrote a solution in Python.. in less than an hour. https://gist.github.com/agrison/1a27a50c22a7f46df17c https://gist.github.com/agrison/1a27a50c22a7f46df17c Next step is to print that and show my boss what a privilege it is for him to have me in his team :)
- svpino 11y agoLooks good!
- gamechangr 11y agoI actually disagree. I could do this problems fairly easily, but #4 and #5 are harder than they look. Are you working in Python or Ruby and are good at managing your emotions during interviews -- then you'ld do good. (or might do good). I would guess there are a number of "qualified" entry level programmers who would struggle to get these done in an hour, especially if you are talking about front end developers or something that is more verbose like Java.
- frickles656 11y agoI can do all these problems in less than 1 hour so I think I'm good.
- alvarospain 11y agoNice read. Not sure I agree with this.
- gnuvince 11y agoI think it's not a bad list to weed out the cheats, though perhaps #4 and #5 weed a bit too wide. I solved #4 a couple weeks ago after a friend of mine who interviewed for Google was asked exactly this (he didn't whine, and eventually got a working solution), and it did take me the better part of an hour fixing up the edge cases.
- 4ydx 11y agoHere is my go at #4. It took me more time than I would like to admit :) http://play.golang.org/p/CTZahLt7g1 http://play.golang.org/p/CTZahLt7g1
- halflings 11y agoDoesn't it say a lot that the author himself gave a wrong solution to the 4th problem at first? Does he think he's a failed Software Engineer? (I wouldn't) ... because he does say on the 5th problem's solutions that he wouldn't consider anyone that wouldn't find a correct solution to those exercises.
- deleted 11y ago[deleted]