Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem Statement The main occupation of the citizens of Numberland is to perform tasks on numbers, One such important task is finding interesting number sequences.
Problem Statement
The main occupation of the citizens of Numberland is to perform tasks on numbers, One such important task is finding interesting number sequences.
As per the Numberland institute of Research, an interesting sequence is defined as a sequence of numbers that are consecutive, for example:
are interesting sequences. Mathematically, an interesting sequence has the following generic property:
The task faced by the research institute is as follows:
Given an ordered set of distinct numbers, extract the length
of the largest interesting sequence that can be obtained
by rearranging the set of numbers.
Help the research institute in finding the longest interesting subsequences.
Input Format
The input consists of two lines.
The first line contains the length of the input sequence.
The second line of input consists of numbers, the sequence of numbers that must be analyzed.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started