New update is available. Click here to update.

Last Updated: 13 Mar, 2021

Difficulty: Easy

```
The given input contains only integers, and only the least significant 8 bits of each integer is used to store the data. This means each integer represents only 1 byte of data.
```

```
Given data = [196, 128, 1], which represents the octet sequence: 11000101 10000010 00000001.
Return true because this is a valid UTF-8 sequence for a 2-byte character followed by a 1-byte character.
```

```
The first line of input contains an integer T denoting the number of test cases.
The first line of each test case contains a single integer 'N', where ‘N’ is the number of elements of the array.
The second line of each test case contains 'N' space-separated integers, denoting the array/list 'DATA'.
```

```
For each test case, return whether the array denotes a correct UTF-8 sequence or not.
The output of each test case will be printed in a separate line.
```

```
You don’t need to print anything, it has been already taken care of. You just need to implement the given function.
```

```
1 <= T <= 5
1 <= N <= 4
1 <= DATA[ i ] < 256
Where ‘DATA[ i ]’ is array element at index ‘i’.
Time limit: 1 sec
```

SIMILAR PROBLEMS

Missing Number

Posted: 30 Oct, 2022

Difficulty: Easy

Longest Subarray With Zero Sum

Posted: 3 Nov, 2022

Difficulty: Moderate

Merge Two Sorted Arrays Without Extra Space

Posted: 19 Nov, 2022

Difficulty: Moderate

Ninja And The Strictly Increasing Array

Posted: 27 Nov, 2022

Difficulty: Moderate

Negative To The End

Posted: 16 Dec, 2022

Difficulty: Easy

Popular Interview Problems: