393. UTF-8-Validation π₯
Medium
Problem:
Verify if the input value is a valid UTF-8 string.

Example 1:
Example 2:
https://leetcode.com/problems/utf-8-validation/
Solution:
firstis the first byte. If the first byte starts with 0, it's a 1-byte character. If it starts with 110, it's a 2-byte character. If it starts with 1110, it's a 3-byte character. If it starts with 11110, it's a 4-byte character.The
check()function takessizeas a parameter and determines if that many bytes start with 10.
Last updated