Programming Exercises

Create a component that finds the longest consecutive sequence in a hardcoded array of integers and displays the result.

Hard

Problem Statement

Create a component that finds the longest consecutive sequence in a hardcoded array of integers and displays the result.

Sample Input

[100, 4, 200, 1, 3, 2]

Sample Output

Longest Sequence: 4

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
import React from "react"; const LongestSequence = () => { return ( <div> {/* Display the longest sequence */} </div> ); }; export default LongestSequence;
Log in or sign up to run or submit your code.Log inSign up
Input
[100, 4, 200, 1, 3, 2]
Expected Output
Longest Sequence: 4