Partial Digit Sequence
Practice
3.2 (8 votes)
Basic programming
Basics of implementation
Easy
Implementation
Problem
59% Success 6522 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given an array A of length N. The partial digit subsequence of an array A is a subsequence of integers in which each consecutive integers have at least 1 digit in common. You are required to find the length of longest partial digit subsequence from the given array.

Input : 

  • The first line of input contains N, length of array A.
  • The second line of input contains N space-separated integers representing elements of A.

Output :

  • Print an integer representing the maximum length of the longest partial digit subsequence of the given array A.

Constraints :

  • \(1 \le N \le 10^{5}\)
  • \(1 \le A_{i} \le 10^{18}\)

   

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
30 votes
Tags:
Basic ProgrammingBasics of ImplementationCombinatoricsEasyImplementation
Points:20
15 votes
Tags:
Basic Programming
Points:20
31 votes
Tags:
Ad-HocBrute-force searchEasyImplementation