Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Javascript: Find the length of the longest fragment in a given array which can be written down using at most two different digits. Task description
Javascript:
Find the length of the longest fragment in a given array which can be written down using at most two different digits.
Task description
Write a function:
function solutionA;
that, given an array A of N integers, returns the length of the longest consistent fragment of A in which all elements can be generated using at most two different digits. You must use the same digits for all elements.
Examples:
Given A the function should return Elements and can be generated using only digits and
Given A the function should return The last two elements can be generated using only digit
Given A the function should return
Assume that:
N is an integer within the range ;
each element of array A is an integer within the range
In your solution, focus on correctness. The performance of your solution will not be the focus of the assessment.
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