|
Challenges
By Blarney in Blarney's Diary Thu Jul 31, 2014 at 10:53:57 PM EST Tags: software problem, ogg frog, super debugging, basic income, MOOC, challenge (all tags)
|
|
|
I have to admit that, for all the discussion of 'challenges' around here, I hadn't really tried any. Now I have. The point of this site CodeEval seems to be that you can complete challenges to win the ability to apply for jobs, and get a good ranking to brag about on your LinkedIn. So now I know what 'challenges' really are - they remind me of the homework that my friends who actually took computer science courses always had to do. I really liked this problem, credited to our overlords at Google.
It took me most of a day to figure it out because I'm not that smart, I scored 97/100 ranking points for speed/memory, but I bet you Kurons could do it much quicker.
|
|
|
|
|
|
I did a few other 'challenges' but I liked this one because there was more to it than looking up an algorithm in Knuth or on Wikipedia and typing it in. It's kind of spooky to think about - the problem involves finding which of 3N-1 expressions satisfy certain criteria, and if you want it to work well for large N you have to do it without actually evaluating each expression - very holistic in feel.
Stuff I learned while doing it:
- Seriously FUCK octal it sucks. Why does '011' still evaluate to 9 in so many languages? It's 2014, there is no PDP11, there is no Lisp Machine, and hopefully anyone who even tries to invent a new CPU with an 18-bit word length will be taken outside and shot. Why do we have to preserve some greybeard's stupid in-joke?
- I don't know much about regexes, but I ended up writing a regex to remove leading zeros from numbers inside arithmetic expressions.
- I better not lose it as I may need it again someday.
- It was still less of a pain than rewriting 'eval' would have been.
- I shouldn't have skipped number theory class so often. Thankfully I still remember some of it. You can totally do all the math for this problem in Z210.
- Once I noticed that I could do the math in Z210, I realized that I should.
- Because that is how people who write problems think - they want you to use the 'trick' they taught you, just as I described in my farce The Cookie Problem
- I am not a genius but I am pretty good at psyching out test problems.
- Yes, there is a way to divide-and-conquer so that you don't have to eval every possible expression.
- (Un)surprisingly, doing things in Z210 actually helped.
- It's pretty complicated, at least more than, say, qsort.
Sadly, to actually get a high site ranking so IMFs will employ me, I need to do lots of these problems, not just the ones that look fun. Like, I would need to grind through FizzBuzz and stuff to get a high score. Which would show to a prospective employer that I love to do lots of boring repetitive work even without getting paid - so why they'd paid me to do more of it, I haven't a clue.
Given the mercenary Friedmanesque hot flat crowded low-wage global slum ethic behind it, I'm glad I got a little fun out of it. It was fun watching my submission do a 15-digit string just like THAT. Boom. It did take me all day to get there. How about you guys?
|
|
|