3 ms·
You said you brute-forced it, but you mentioned index variables. I thought the brute force solution would look something like: merged = sorted(a + b) media
by anothergoogler 8y ago
You said you brute-forced it, but you mentioned index variables. I thought the brute force solution would look something like:
merged = sorted(a + b)
median = merged[len(merged) / 2]
Like twunde said, you just sound rusty. How often do you write code? Do you use Python or something else? It sounds like you're putting too much pressure on yourself.
- marvy 8y agoNow THAT's brute force :)
- srtjstjsj 8y agoThat's not brute force; that's calling in the cavalry to do brute force for you.
- anothergoogler 8y agoMeh, it's a concise description of a median and it only uses builtin functions. People take "brute" too literally and think it means you should be writing a lot of code: It's about the performance.