Skip to content

Commit

Permalink
new commit
Browse files Browse the repository at this point in the history
  • Loading branch information
innovationchef committed May 16, 2016
1 parent 3a8c097 commit ae29e6b
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 0 deletions.
25 changes: 25 additions & 0 deletions altaray.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env python
minm = -1000000000
maxm = 1000000000
testcases = int(raw_input())
if(testcases<1 or testcases>10):
exit()
for i in range(0, testcases):
N = int(raw_input())
if(N<1 or N>pow(10,5)):
exit()
numbers = map(int,raw_input().split(" "))
listing = []
for j in range(0, (len(numbers)-1)):
count = 1
for k in range(j, (len(numbers)-1)):
if (numbers[k]*numbers[k+1]<0):
count += 1
else:
break
listing.append(count)
listing.append(count)
print ' '.join(str(a) for a in listing)



17 changes: 17 additions & 0 deletions color.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env python

testcases = int(raw_input())
if(testcases<1 or testcases>10):
exit()
for i in range(0, testcases):
N = int(raw_input())
if(N<1 or N>pow(10,5)):
exit()
S=raw_input()
noR=S.count("R")
noG=S.count("G")
noB=S.count("B")
ans=len(S)-max(noR,noG,noB)
print ans


4 changes: 4 additions & 0 deletions rgame.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ def addToEnd(inputList, x):
# return(endProduct+initialProduct)

testcases = int(raw_input())
if(testcases<1 or testcases>10):
exit()
for i in range(0, testcases):
N = int(raw_input())
if(N<1 or N>100000):
exit()
numbers = map(int,raw_input().split(" "))
testList = [numbers[0]]
addToEnd(testList, 1)
Expand Down
84 changes: 84 additions & 0 deletions strpalin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#https://www.codechef.com/viewsolution/9959096

testcases = int(raw_input())
if(testcases<1 or testcases>10):
exit()
for i in range(0, testcases):
A=raw_input()
B=raw_input()
if(len(A)<1 or len(A)>1000 or len(B)<1 or len(B)>1000):
exit()
i = 0
j = 0
flag = 0;
if (len(A)>=26 and len(B)>=26):
while i < 26:
while j < 26:
if A[i]==B[j]:
flag = 1
break
else:
flag = 0
j += 1
i+=1
if flag == 1:
break

if(len(A)<26 and len(B)>26):
while i < len(A):
while j < 26:
if A[i]==B[j]:
flag = 1
break
else:
flag = 0
j += 1
i+=1
if flag == 1:
break

if(len(A)>26 and len(B)<26):
while i < len(B):
while j < 26:
if B[i]==A[j]:
flag = 1
break
else:
flag = 0
j += 1
i+=1
if flag == 1:
break

if(len(A)<26 and len(B)<26):
if len(A)<len(B):
while i < len(A):
while j < len(B):
if A[i]==B[j]:
flag = 1
break
else:
flag = 0
j += 1
i+=1
if flag == 1:
break

elif len(A)>=len(B) :
while i < len(B):
while j < len(A):
if(B[i] == A[j]):#KUCH LOAD HAI!!!!!!!!!!!!!!!!!!!!!!!!
flag = 1
break
else:
flag = 0
j += 1
i+=1
if flag == 1:
break


if flag == 1:
print ("YES")
else:
print ("NO")

0 comments on commit ae29e6b

Please sign in to comment.