All Tracks Data Structures Arrays 1-D Problem

Digital Sequence
/

1-D Array, Arrays, Data Structures, easy

Problem
Editorial
Analytics
Description

You are given an array A of length N. You need to find maximum length of subsequence of A which contains any one digit common in all the elements of that subsequence. You are not allowed to count leading zeroes.

Input Format:

First line of input contains N, denoting number of elements.
Second line of input contains N space separated integers, denoting array elements.

Output Format:

Single integer representing maximum length of subsequence containing one digit common.

Input Constraints:

\(1 \le N \le 10^5\)

\(1 \le A_i \le 10^9\)

SAMPLE INPUT
5
12 11 3 4 5
SAMPLE OUTPUT
2
Explanation

Maximum length subsequence with one digit common is [ 12 11 ].

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

This Problem was Asked in

Initializing Code Editor...
Notifications
View All Notifications

?