4 ms·
This seems like a contrived example. You don't usually want recursive code in your product. A more useful example was when I asked my high school AP Computer S
by mncolinlee 15y ago
This seems like a contrived example. You don't usually want recursive code in your product.
A more useful example was when I asked my high school AP Computer Science class years ago to test if an array of integers contained a poker straight without using a parser, assuming ace=1, jack=11, queen=12, king=13. The key was to see if they knew how to think about algorithms. I wanted them to perform a sort and iterate across the array, but was interested in what they came up with. It tested a lot of important concepts in thinking about problems, which is more important to me than correct syntax on a whiteboard or implementing valid recursion on the fly.