@@ -0,0 +1,1829 @@
+%22%22%22Leetcode 393. UTF-8 Validation%0AMedium%0A%0AURL: https://leetcode.com/problems/utf-8-validation/%0A%0AA character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules:%0A- For 1-byte character, the first bit is a 0, followed by its unicode code.%0A- For n-bytes character, the first n-bits are all one's, the n+1 bit is 0, followed%0A  by n-1 bytes with most significant 2 bits being 10.%0A%0AThis is how the UTF-8 encoding would work:%0A   Char. number range  %7C        UTF-8 octet sequence%0A      (hexadecimal)    %7C              (binary)%0A   --------------------+---------------------------------------------%0A   0000 0000-0000 007F %7C 0xxxxxxx%0A   0000 0080-0000 07FF %7C 110xxxxx 10xxxxxx%0A   0000 0800-0000 FFFF %7C 1110xxxx 10xxxxxx 10xxxxxx%0A   0001 0000-0010 FFFF %7C 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx%0AGiven an array of integers representing the data, return whether it is a valid utf-8%0Aencoding.%0A%0ANote:%0AThe input is an array of integers. Only the least significant 8 bits of each integer%0Ais used to store the data. This means each integer represents only 1 byte of data.%0A%0AExample 1:%0Adata = %5B197, 130, 1%5D, which represents the octet sequence: 11000101 10000010 00000001.%0AReturn true.%0AIt is a valid utf-8 encoding for a 2-bytes character followed by a 1-byte character.%0A%0AExample 2:%0Adata = %5B235, 140, 4%5D, which represented the octet sequence: 11101011 10001100 00000100.%0AReturn false.%0AThe first 3 bits are all one's and the 4th bit is 0 means it is a 3-bytes character.%0AThe next byte is a continuation byte which starts with 10 and that's correct.%0ABut the second continuation byte does not start with 10, so it is invalid.%0A%22%22%22%0A%0Aclass Solution(object):%0A    def validUtf8(self, data):%0A        %22%22%22%0A        :type data: List%5Bint%5D%0A        :rtype: bool%0A        %22%22%22%0A        pass%0A%0A%0Adef main():%0A    pass%0A%0A%0Aif __name__ == '__main__':%0A    main()%0A

Add lc0393_utf-8_validation.py