Skip to content
Open

PR-1 #374

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
a6c7958
Create Vignesh_On_Date
sahasrachiliveri Nov 14, 2024
95f868a
Create Vignesh_and_Gym
sahasrachiliveri Nov 14, 2024
b856a42
Create Best_Coupon
sahasrachiliveri Nov 14, 2024
576c165
Create Bridge_Crossing
sahasrachiliveri Nov 14, 2024
e94fe51
Create Count_NoteBooks
sahasrachiliveri Nov 14, 2024
bf91916
Create Find_Age
sahasrachiliveri Nov 14, 2024
f9aaa0a
Create Netflix_SUB
sahasrachiliveri Nov 14, 2024
694b172
Create Pending_Assignments
sahasrachiliveri Nov 14, 2024
01354b2
Create R_P_S
sahasrachiliveri Nov 14, 2024
3e5aa7c
Create Test_Score
sahasrachiliveri Nov 14, 2024
992f525
Create Round_Table
sahasrachiliveri Nov 14, 2024
d2aa32d
Create Leap_Year.py
sahasrachiliveri Nov 14, 2024
c5a7486
Delete visa_prep/Best_Coupon
sahasrachiliveri Nov 14, 2024
6baeeb3
Create Best_Coupon.py
sahasrachiliveri Nov 14, 2024
d665fff
Delete visa_prep/Bridge_Crossing
sahasrachiliveri Nov 14, 2024
f6517b3
Create Bridge_Crossing.py
sahasrachiliveri Nov 14, 2024
3b26a71
Delete visa_prep/Count_NoteBooks
sahasrachiliveri Nov 14, 2024
cb00f40
Create Count_Notebooks.py
sahasrachiliveri Nov 14, 2024
cc24da1
Delete visa_prep/Find_Age
sahasrachiliveri Nov 14, 2024
2d1eb61
Create Find_Age.py
sahasrachiliveri Nov 14, 2024
c25ffa2
Delete visa_prep/Netflix_SUB
sahasrachiliveri Nov 14, 2024
a5b5f89
Create Netflix_SUB.py
sahasrachiliveri Nov 14, 2024
1dc87cc
Delete visa_prep/Pending_Assignments
sahasrachiliveri Nov 14, 2024
a949eaf
Create Pending_Assignments.py
sahasrachiliveri Nov 14, 2024
5f2afcf
Delete visa_prep/R_P_S
sahasrachiliveri Nov 14, 2024
9356603
Create P_P_S.py
sahasrachiliveri Nov 14, 2024
9ee0fce
Delete visa_prep/Round_Table
sahasrachiliveri Nov 14, 2024
b45bc4f
Create Round_Table.py
sahasrachiliveri Nov 14, 2024
fe16a4c
Delete visa_prep/Test_Score
sahasrachiliveri Nov 14, 2024
2881b1f
Create Test_Score.py
sahasrachiliveri Nov 14, 2024
1db90bc
Delete visa_prep/Vignesh_On_Date
sahasrachiliveri Nov 14, 2024
653716a
Create Vignesh_On_Date.py
sahasrachiliveri Nov 14, 2024
84641e1
Delete visa_prep/Vignesh_and_Gym
sahasrachiliveri Nov 14, 2024
9900b98
Create Vignesh_and_Gym.py
sahasrachiliveri Nov 14, 2024
1dfa6e9
Create Valentine's_Day.py
sahasrachiliveri Nov 14, 2024
e50439a
Create AirLines.py
sahasrachiliveri Nov 14, 2024
747464d
Create Season_Game.py
sahasrachiliveri Nov 14, 2024
2e6dcde
Create String_Reduce.py
sahasrachiliveri Nov 14, 2024
b358dce
Create Ajay's_Score_Calculation.py
sahasrachiliveri Nov 14, 2024
e175031
Create BIT_SET.py
sahasrachiliveri Nov 14, 2024
94c884c
Create Triangle_pattern_2.py
sahasrachiliveri Nov 14, 2024
d1e269d
Create Score_Calculation.py
sahasrachiliveri Nov 15, 2024
0c3058d
Create On_Time_Arrival.py
sahasrachiliveri Nov 15, 2024
dae6f39
Create Even_Odd_Game_1.py
sahasrachiliveri Nov 15, 2024
79f3427
Create Triangle_pattern_1.py
sahasrachiliveri Nov 15, 2024
baa660b
Create Ticket_Fever.py
sahasrachiliveri Nov 15, 2024
4645959
Create Factorial_1.py
sahasrachiliveri Nov 15, 2024
864e9b7
Create Reverse_Array.py
sahasrachiliveri Nov 15, 2024
78d54fe
Create isBalance_ElevateBox.py
sahasrachiliveri Nov 15, 2024
991db1c
Create Reverse_Integer.py
sahasrachiliveri Nov 15, 2024
f708265
Create Mirror_magic.py
sahasrachiliveri Nov 15, 2024
8e7b978
Create DND.py
sahasrachiliveri Nov 15, 2024
724b292
Create Multiple_Challenge.py
sahasrachiliveri Nov 15, 2024
4ea0213
Delete visa_prep/Multiple_Challenge.py
sahasrachiliveri Nov 15, 2024
327684c
Create Multiple_Challenge.py
sahasrachiliveri Nov 15, 2024
d124b63
Create Pair_Sum_1.py
sahasrachiliveri Nov 15, 2024
a9dbd76
Create In_the_Range_or_Not.py
sahasrachiliveri Nov 15, 2024
ad3317a
Create Reache_the_Target.py
sahasrachiliveri Nov 15, 2024
88538fe
Create Palindrome_Check.py
sahasrachiliveri Nov 15, 2024
422b544
Create Single_Number.py
sahasrachiliveri Nov 17, 2024
e8b96bc
Create is_Array_Sorted.py
sahasrachiliveri Nov 17, 2024
7b47c83
Create Matrix_Sum.py
sahasrachiliveri Nov 17, 2024
d9afadb
Create Vignesh's_Greed.py
sahasrachiliveri Nov 17, 2024
2a1a384
Create shift_array_K.py
sahasrachiliveri Nov 17, 2024
fe4af30
Create The_Signal_Shutdown_Puzzle.py
sahasrachiliveri Nov 17, 2024
e19f25b
Create Triangle_pattern_3.py
sahasrachiliveri Nov 17, 2024
5671730
Create Bhanu's_Message.py
sahasrachiliveri Nov 17, 2024
71061ae
Create Unique_Order.py
sahasrachiliveri Nov 17, 2024
381a100
Create shift_array_1.py
sahasrachiliveri Nov 17, 2024
507ac40
Create Transpose_of_Matrix.py
sahasrachiliveri Nov 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions visa_prep/AirLines.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

X, N = map(int, input().split())
c = X * 100
if N > c:
rp = N - c
ap = (rp + 99) // 100
else:
ap = 0
print(ap)
6 changes: 6 additions & 0 deletions visa_prep/Ajay's_Score_Calculation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
T = int(input())
for _ in range(T):
X, N = map(int, input().split())
p = X // 10
res = p* N
print(res)
7 changes: 7 additions & 0 deletions visa_prep/BIT_SET.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
N=int(input())
k=int(input())
if N & (1 << (k - 1)):
print("true")
else:
print("false")

6 changes: 6 additions & 0 deletions visa_prep/Best_Coupon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
x=int(input())
dis=0.1*x
dis100=100
maxdis=max(dis,dis100)
res=x-maxdis
print(int(res))
26 changes: 26 additions & 0 deletions visa_prep/Bhanu's_Message.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
def valid(m):
if len(m)<10 or len(m)>20:
return False
if m[0]=='+':
m=m[1:]
if not all(c.isdigit() or c==' ' for c in m):
return False
n=m.split()
if len(n)==2:
code,ph=n[0],n[1]
if not(len(code)==2 and code.isdigit()):
return False
elif len(n)==1:
ph=n[0]
else:
return False
if len(ph)!=10 or not ph.isdigit():
return False
s=sum(int(digit) for digit in ph)
return s>0
if __name__=="__main__":
m=input().strip()
if valid(m):
print("Correct")
else:
print('Incorrect')
3 changes: 3 additions & 0 deletions visa_prep/Bridge_Crossing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
x,y,z=map(int,input().split())
n=(z-y)//x
print(n)
3 changes: 3 additions & 0 deletions visa_prep/Count_Notebooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
n=int(input())
books=n*10
print(books)
13 changes: 13 additions & 0 deletions visa_prep/DND.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def cd(N,m,arr):
n1=0
n2=0
for number in arr:
if number%m==0:
n2+=number
else:
n1+=number
return n2-n1
N,m=map(int,input().strip().split())
arr=list(map(int,input().strip().split()))
res=cd(N,m,arr)
print(res)
6 changes: 6 additions & 0 deletions visa_prep/Even_Odd_Game_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
N=input().strip()
ds=sum(int(digit) for digit in N)
if ds%2==0:
print("Vignesh")
else:
print("Charan")
9 changes: 9 additions & 0 deletions visa_prep/Factorial_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def fact(n):
if n==0:
return 1
res=1
for i in range(1,n+1):
res*=i
return res
n=int(input())
print(fact(n))
3 changes: 3 additions & 0 deletions visa_prep/Find_Age.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
x=int(input())
y=x-15
print(y)
7 changes: 7 additions & 0 deletions visa_prep/In_the_Range_or_Not.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
T=int(input())
for _ in range(T):
X=int(input())
if 67<=X<=45000:
print("YES")
else:
print("NO")
5 changes: 5 additions & 0 deletions visa_prep/Leap_Year.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
x=int(input())
if (x % 4 == 0 and x % 100 != 0) or (x % 400 == 0):
print("YES")
else:
print("NO")
9 changes: 9 additions & 0 deletions visa_prep/Matrix_Sum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def smat(N,mat):
rs=[sum(mat[i]) for i in range(N)]
cs=[sum(mat[i][j] for i in range(N)) for j in range(N)]
res=[rs[i]+cs[i] for i in range(N)]
return res
N=int(input())
mat=[list(map(int,input().split())) for _ in range(N)]
res=smat(N,mat)
print(" ".join(map(s
13 changes: 13 additions & 0 deletions visa_prep/Mirror_magic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def mirr(mat):
mm=[]
for row in mat:
mm.append(row[::-1])
return mm
N=int(input().strip())
mat=[]
for _ in range(N):
row=list(map(int,input().strip().split()))
mat.append(row)
mm=mirr(mat)
for row in mm:
print(" ".join(map(str,row)))
8 changes: 8 additions & 0 deletions visa_prep/Multiple_Challenge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def cd(N):
c3=N//3
c5=N//5
c15=N//15
c=c3+c5-c15
return c
N=int(input().strip())
res=cd(N)
5 changes: 5 additions & 0 deletions visa_prep/Netflix_SUB.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
a,b,c,x=map(int,input().split())
if (a+b or b+c or a+c)>=x:
print("YES")
else:
print("NO")
7 changes: 7 additions & 0 deletions visa_prep/On_Time_Arrival.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
T=int(input())
for _ in range(T):
X=int(input())
if X>=30:
print("YES")
else:
print("NO")
7 changes: 7 additions & 0 deletions visa_prep/P_P_S.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
x,y=map(str,input().split())
if x==y:
print("NULL")
elif (x=="R" and y=="P") or (x=="P" and y=="S") or (x=="S" and y=="R"):
print("Charan")
else:
print("Vignesh")
15 changes: 15 additions & 0 deletions visa_prep/Pair_Sum_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
def ps(arr,k):
s=set()
for number in arr:
com=k-number
if com in s:
return True
s.add(number)
return False
N=int(input().strip())
arr=list(map(int,input().strip().split()))
k=int(input().strip())
if ps(arr,k):
print("true")
else:
print("false")
5 changes: 5 additions & 0 deletions visa_prep/Palindrome_Check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
s=input().strip()
if s==s[::-1]:
print("TRUE")
else:
print("FALSE")
7 changes: 7 additions & 0 deletions visa_prep/Pending_Assignments.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
x,y,z=map(int,input().split())
timetaken=x*y
time=z*24*60
if timetaken<=time:
print("YES")
else:
print("NO")
5 changes: 5 additions & 0 deletions visa_prep/Reache_the_Target.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
T=int(input())
for _ in range(T):
X,Y=map(int,input().split())
rn=(X-Y)+1
print(rn)
4 changes: 4 additions & 0 deletions visa_prep/Reverse_Array.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
n=int(input())
a=list(map(int,input().split()))
ra=a[::-1]
print(" ".join(map(str,ra)))
17 changes: 17 additions & 0 deletions visa_prep/Reverse_Integer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def reverseint(n):
min=-2**31
max=2**31-1
sign=-1 if n<0 else 1
n*=sign
revn=0
while n>0:
dig=n%10
n//=10
revn=revn*10+dig
revn*=sign
if revn<min or revn>max:
return 0
return revn
n=int(input().strip())
res=reverseint(n)
print(res)
4 changes: 4 additions & 0 deletions visa_prep/Round_Table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import math
X = int(input())
ways = math.factorial(X)
print(ways)
6 changes: 6 additions & 0 deletions visa_prep/Score_Calculation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
T=int(input())
for _ in range(T):
X,N=map(int,input().split())
p=X//10
res=p*N
print(res)
11 changes: 11 additions & 0 deletions visa_prep/Season_Game.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
N = int(input())
if 3 <= N <= 5:
print("Spring")
elif 6 <= N <= 8:
print("Summer")
elif 9 <= N <= 11:
print("Autumn")
elif N == 12 or 1 <= N <= 2:
print("Winter")
else:
print("Invalid")
9 changes: 9 additions & 0 deletions visa_prep/Single_Number.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def fn(arr):
res=0
for num in arr:
res^=num
return res
N=int(input().strip())
arr=list(map(int,input().strip().split()))
sn=fn(arr)
print(sn)
13 changes: 13 additions & 0 deletions visa_prep/String_Reduce.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def reduce_string(s):
res = []
c = 1
for i in range(1, len(s)):
if s[i] == s[i-1]:
c += 1
else:
res.append(s[i-1] + str(c))
c= 1
res.append(s[-1] + str(c))
return ''.join(res)
input= input().strip()
print(reduce_string(input))
6 changes: 6 additions & 0 deletions visa_prep/Test_Score.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
n,x,y=map(int,input().split())
marks=n*x
if 0<=y<=marks and y%x==0:
print("YES")
else:
print("NO")
17 changes: 17 additions & 0 deletions visa_prep/The_Signal_Shutdown_Puzzle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def f(n,m,g):
r=set()
c=set()
for i in range(n):
for j in range(m):
if g[i][j]==0:
r.add(i)
c.add(j)
for i in range(n):
for j in range(m):
if i in r or j in c:
g[i][j]=0
for r in g:
print(" ".join(map(str,r)))
n,m=map(int,input().split())
g=[list(map(int,input().split())) for _ in range(n)]
f(n,m,g)
5 changes: 5 additions & 0 deletions visa_prep/Ticket_Fever.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
T=int(input())
for _ in range(T):
N,M=map(int,input().split())
st=max(0,N-M)
print(st)
9 changes: 9 additions & 0 deletions visa_prep/Transpose_of_Matrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
n=int(input())
mat=[list(map(int,input().split())) for _ in range(n)]
def t(mat):
r=len(mat)
c=len(mat[0])
tr=[[mat[j][i] for j in range(r)] for i in range(c)]
return tr
for r in t(mat):
print(*r)
8 changes: 8 additions & 0 deletions visa_prep/Triangle_pattern_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
N=int(input())
cn=1
for i in range(1,N+1):
rn=[]
for j in range(i):
rn.append(cn)
cn+=1
print(" ".join(map(str,rn)))
3 changes: 3 additions & 0 deletions visa_prep/Triangle_pattern_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
N = int(input())
for i in range(1, N + 1):
print(" ".join([str(i)] * i))
9 changes: 9 additions & 0 deletions visa_prep/Triangle_pattern_3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
n=int(input())
for i in range(1,n+1):
f=''.join(str(x) for x in range(1,i+1))
s=''.join(str(x) for x in range(i,0,-1))
sp=' '*(2*(n-i))
if i==n:
print(f+s)
else:
print(f+sp+s)
11 changes: 11 additions & 0 deletions visa_prep/Unique_Order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def uo(a):
s=set()
r=[]
for n in a:
if n not in s:
r.append(n)
s.add(n)
return r
n=int(input())
a=list(map(int,input().split()))
print(*uo(a))
3 changes: 3 additions & 0 deletions visa_prep/Valentine's_Day.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
X, Y = map(int, input().split())
max_chocolates = X // Y
print(max_chocolates)
9 changes: 9 additions & 0 deletions visa_prep/Vignesh's_Greed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def mt(N,s):
s.sort(reverse=True)
for i in range(N-2):
if s[i]<s[i+1]+s[i+2]:
return s[i]+s[i+1]+s[i+2]
return -1
N=int(input())
s=list(map(int,input().split()))
print(mt(N,s))
6 changes: 6 additions & 0 deletions visa_prep/Vignesh_On_Date.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
x,y=map(int,input().split())
#=input()
if x>=y:
print("YES")
else:
print("NO")
7 changes: 7 additions & 0 deletions visa_prep/Vignesh_and_Gym.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
X, Y, Z = map(int, input().split())
if Z >= X + Y:
print(2)
elif Z >= X:
print(1)
else:
print(0)
11 changes: 11 additions & 0 deletions visa_prep/isBalance_ElevateBox.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
N=int(input())
A=list(map(int,input().split()))
ts=sum(A)
ls=0
ba=[]
for i in range(N):
rs=ts-ls-A[i]
b=abs(ls-rs)
ba.append(b)
ls+=A[i]
print(" ".join(map(str,ba)))
Loading