Watching this stream: https://www.twitch.tv/videos/821587009
Watching LizTheGrey’s stream. She’s fantastic. She’s going through computer science principles that factor into the choices she’s making
Today I learned
- Thinking about how much work we’re doing is an important exercise. Avoiding repeatedly computing the same thing makes a lot of sense (relates to algorithmic complexity)
- If you are making an assumption about input (eg no negative values, no zeros) you can make this explicit by adding an assertion so that your program fails fast (with hopefully a helpful error) when that assumption is invalidated
- This one is a bit of a bugger. My solution uses a binary search strategy with low, high pointers that shift as you get closer to your goal. Not hard to write but was a bit fiddly
- Liz (and others I can see) did something much simpler. Set ‘B’ -> 1 and ‘R’ -> 1 in the input, ignored ‘F’ and ‘L’ (or set these to zero) and somehow with only a little more energy got the answer. What the hell is going on here?
Have to think about this one a bit more
Had to remind myself today to not try to overly anticipate what part b will ask me to do. More often than not the complexity of part a goes up and what I think is coming next doesn’t.
Keeping it simple is an important principle in systems design!
Alright so part 2 I don’t understand the answer for. I have to think about this one a bit more. It’s only a few lines long …