title: Implementing an algorithm to determine if a string has all unique characters
body: <p>Context: I'm a CS n00b working my way through "Cracking the Coding Interview." The first problem asks to "implement an algorithm to determine if a string has all unique characters." My (likely naive) implementation is as follows:</p>
  
  <pre><code>def isUniqueChars2(string):
    uchars = []
    for c in string:
      if c in uchars:
        return False
      else:
        uchars.append(c)
    return True
  </code></pre>
  
  <p>The author suggests the following implementation:</p>
  
  <pre><code>def isUniqueChars(string):
    checker = 0
    for c in string:
      val = ord(c) - ord('a')
      if (checker &amp; (1 &lt;&lt; val) &gt; 0):
        return False
      else:
        checker |= (1 &lt;&lt; val)
    return True
  </code></pre>
  
  <p>What makes the author's implementation better than mine (FWIW, the author's solution was in Java and I converted it to Python -- is my solution one that is not possible to implement in Java)? Or, more generally, what is desirable in a solution to this problem? What is wrong with the approach I've taken? I'm assuming there are some fundamental CS concepts (that I'm not familiar with) that are important and help inform the choice of which approach to take to this problem.</p>