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}\)
Sample Input
2 12 23
Sample Output
2
Explanation
The longest partial digit subsequence of the given array is [12, 23]. as 12 and 23 contain 2 as the common digit.
Code Editor
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
Submissions
Please login to view your submissions
Similar Problems
1.Acronym
Points:20
111 votes
Tags:
Ad-HocApprovedEasyOpenString Manipulation
Points:20
59 votes
Tags:
AlgorithmsBasic ProgrammingBasics of ImplementationEasyImplementationMathNumber TheorySieve
Points:20
50 votes
Tags:
ApprovedBasic ProgrammingEasyHash MapsOpen
Editorial
Login to unlock the editorial
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