Comment

Comment by smnscu

Ah, the perennial apologetics of weaponized mediocrity. If you can't write a simple recursive algorithm that swaps two values (Max Howell), two nested for loops (DHH), or show me that you used Python at least once (uhh length? yes, there is this builtin, I forgot its name...), why would I want to hire you over someone who has seen a computer before?

And to avoid being called hypocritical, here's off the top of my head how the answers would look like (I don't use Python very often either):

1. len(thingie)

2.

  def bubsort(arr):
    if not arr: return None
    for i in range(len(arr)):
      for j in range(i+1, len(arr)):
        if arr[i] > arr[j]: arr[i], arr[j] = arr[j], arr[i]
    return arr
3.

  def revtree(node):
    if not node: return None
    node.left, node.right = revtree(node.right), revtree(node.left)
    return node
edit: works well for something coded on the toilet: https://gist.github.com/andreis/69a242330617b2a62753ce604e27...
parent smnscu 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton