LeetCode 393: UTF-8 Validation
Problem Restatement We are given an integer array data . Each integer represents one byte of data. Only the least significant 8 bits are used. We need to decide whether this byte sequence is a valid UTF-8 encoding. A UTF-8 character can be 1 to 4 bytes long. The valid byte patterns are: Number of bytes Pattern 1 byte 0xxxxxxx 2 bytes 110xxxxx 10xxxxxx 3 bytes 1110xxxx 10xxxxxx 10xxxxxx 4...