class Solution(object):
    def validUtf8(self, data):
        """
        :type data: List[int]
        :rtype: bool
        """
        it = iter(data)
        while True:
            try:
                c = it.next() & 0xff
                try:
                    t = 0x80
                    n = 0
                    while t > 0:
                        if t & c:
                            n += 1
                            t >>= 1
                        else:
                            break
                    if n == 1 or n > 4:
                        return False
                    elif n > 1:
                        for _ in xrange(n - 1):
                            c = it.next() & 0xff
                            if c & 0xc0 != 0x80:
                                return False
                except StopIteration:
                    return False
            except StopIteration:
                return True


Add py solution for 393. UTF-8 Validation
Add py solution for 393. UTF-8 Validation

393. UTF-8 Validation: https://leetcode.com/problems/utf-8-validation/

Approach:
    Observe the first item remaining in each step. The value will be added
    1 << step either the remaining count is odd or it's a left-to-right
    step. Hence the n | 0x55555.. is the key.
