Startup and Tech
Monday, 20 July 2020
Codeforces 1324B - Yet Another Palindrome Problem Solution In Python
Program
t = int(input()) for i in range(t): n = int(input()) a = [int(j) for j in input().split()[:n]] f=0 for i in range(n): a.append(i) x = [] v=[] for k in range(n): if(a[k] not in x): x.append(a[k]) else: l = k c = a.index(a[k]) if(l-c>1): f += 1 break else: pass if(f>0): if (l - c > 1): print('YES') else: print('NO')
Output
5 I/P: 3 1 2 1 5 1 2 2 3 2 3 1 1 2 4 1 2 2 1 10 1 1 2 2 3 3 4 4 5 5 O/P: YES YES NO YES NO
Codeforces 1328A - Divisibility Problem Solution In Python-
https://www.techrcoding.com/2020/07/codeforces-1328a.html
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment