美文网首页
393. UTF-8 Validation

393. UTF-8 Validation

作者: 我是你的果果呀 | 来源:发表于2016-12-26 06:52 被阅读0次

    A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules:
    For 1-byte character, the first bit is a 0, followed by its unicode code.
    For n-bytes character, the first n-bits are all one's, the n+1 bit is 0, followed by n-1 bytes with most significant 2 bits being 10.
    This is how the UTF-8 encoding would work:

    Given an array of integers representing the data, return whether it is a valid utf-8 encoding.

    相关文章

      网友评论

          本文标题:393. UTF-8 Validation

          本文链接:https://www.haomeiwen.com/subject/zjadvttx.html