Skip to content

Instantly share code, notes, and snippets.

View gauravkoradiya's full-sized avatar
🤖
Available for Contribution

Gaurav Koradiya gauravkoradiya

🤖
Available for Contribution
  • San Jose State University
  • San Francisco, California, USA
  • 10:45 (UTC -12:00)
View GitHub Profile
@gauravkoradiya
gauravkoradiya / LRNDSA01_MULTHREE.py
Created April 26, 2020 13:26
Codechef_DSA01 - Multiple of 3 - Code: MULTHREE
# https://www.codechef.com/LRNDSA01/problems/MULTHREE
def check_multiple_of_three(k, d0, d1):
if k == 2:
return not ((d0 + d1) % 3)
sum_of_digits = d0 + d1 + ((d0 + d1) % 10)
if k > 3:
a = ((d0 + d1) << 1) % 10
b = ((d0 + d1) << 2) % 10
@gauravkoradiya
gauravkoradiya / LRNDSA01_LADDU.py
Created April 26, 2020 09:45
Codechef_DSA01 - Laddu - Problem Code: LADDU
# cook yur dish here
# https://www.codechef.com/LRNDSA01/problems/LADDU
def LADDU_ACCURAL_SYSTEM(activity):
if activity[0] == 'CONTEST_WON':
return 300 + ((20 - int(activity[1])) if int(activity[1])<20 else 0)
if activity[0] == 'TOP_CONTRIBUTOR':
return 300
if activity[0] == 'BUG_FOUND':
return int(activity[1])
if activity[0] == 'CONTEST_HOSTED':
@gauravkoradiya
gauravkoradiya / LRNDSA01_CONFLIP.py
Created April 26, 2020 08:07
Codechef_DSA01 - CONFLIP
# https://www.codechef.com/LRNDSA01/problems/CONFLIP
import math
def main():
for _ in range(int(input())):
for _ in range(int(input())):
I,N,Q = map(int, input().split())
if I == Q:
print(math.floor(N/2))
else:
@gauravkoradiya
gauravkoradiya / LRNDSA01_FCTRL.py
Created April 26, 2020 04:43
Codechef_DSA01 - Factorial - FCTRL
# https://www.codechef.com/LRNDSA01/problems/FCTRL
def solution(a):
if a < 5:
return 0
else:
b = a // 5
return b + solution(b)
@gauravkoradiya
gauravkoradiya / LRNDSA01_CARVANS.py
Created April 25, 2020 14:01
Codechef_DSA01 - Carvans - CARVANS
# https://www.codechef.com/problems/CARVANS
def main():
for T in range(int(input())):
num_cars = int(input())
speed = map(lambda x: int(x) , input().split())
count = 0
max_speed = float('inf')
for i in speed:
if i < max_speed:
@gauravkoradiya
gauravkoradiya / LRNDSA01_ZCO14003.py
Created April 19, 2020 12:56
Codechef_DSA01 - Smart Phone - ZCO14003
"""https://www.codechef.com/LRNDSA01/problems/ZCO14003/"""
def main():
num_customer = int(input())
bgt_lst = sorted([int(input()) for i in range(num_customer)],reverse=True)
revenue = max([(index+1)*value for index,value in enumerate(bgt_lst)])
print(revenue)
if __name__ == '__main__':
main()
@gauravkoradiya
gauravkoradiya / LRNDSA01_LAPIN.py
Last active April 19, 2020 09:55
Codechef_DSA01 - Lapindromes - Problem Code: LAPIN
"""https://www.codechef.com/LRNDSA01/problems/LAPIN"""
def LRNDSA01(ip,first_end,second_start,strlen):
d = dict()
for i in range(first_end):
d[ip[i]] = d.get(ip[i],0)+1
for j in range(second_start,strlen):
try:
@gauravkoradiya
gauravkoradiya / test.py
Last active April 19, 2020 08:27
Codechef_DSA01 - Reverse The Number - FLOW007
"""https://www.codechef.com/LRNDSA01/problems/FLOW007"""
def main():
n=int(input())
while(n!=0):
print(int(input()[::-1]))
n-=1
if __name__ == '__main__':
@gauravkoradiya
gauravkoradiya / test.py
Created April 19, 2020 08:06
Codechef_DSA01 - Life, the Universe, and Everything - TEST
"""https://www.codechef.com/LRNDSA01/problems/TEST"""
def main():
"""if input is 42 than stop the processing"""""
x = int(input().strip())
while x != 42 :
print(x)
x = int(input().strip())
if __name__ == '__main__':