Please explain test case [250,145,145,145,145]

  • 0

    Its binary representation is

    [11111010, 10010001, 10010001, 10010001, 10010001]

    The first byte indicates a character encoded over 5 bytes.
    The folliwing n-1 (4) bytes start with 10.

    Why is the expected result false?

  • 0

    A character in UTF8 can be from 1 to 4 bytes long.
    So you cannot use 5 bytes long to encode a character.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.