Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added links in main readme #8

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@ Moreover, the sources will be provided to solve a particular problem whenever a
<ul>
<li> Basic knowledge of any programming language </li>
<li> It is recommended that you Sign-up on at least HackerRank and Leetcode, most of the questions will be from them. </li>
<br>
<a href='./Learn and grow.md'>Learn and grow</a>
<br>
<a href='./Question Bank/Questions.md'>Question Bank</a>

50 changes: 50 additions & 0 deletions Solutions/between-two-sets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/python3

import os
import sys

#
# Complete the getTotalX function below.
#
def gcd(a,b):

# Everything divides 0
if (b == 0):
return a
return gcd(b, a%b)

def getTotalX(a, b):
g = b[0]
for i in range(1,len(b)):
g=gcd(g,b[i])
l = a[0]
for i in range(1,len(a)):
l = (l*a[i])/gcd(l,a[i])
if(g%l != 0):
return 0
i=0
x=l
while(g>=x):
if(g%x==0):
i+=1
x+=l
return i

if __name__ == '__main__':
f = open(os.environ['OUTPUT_PATH'], 'w')

nm = input().split()

n = int(nm[0])

m = int(nm[1])

a = list(map(int, input().rstrip().split()))

b = list(map(int, input().rstrip().split()))

total = getTotalX(a, b)

f.write(str(total) + '\n')

f.close()
32 changes: 32 additions & 0 deletions Solutions/jumping-on-the-clouds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/python3

import math
import os
import random
import re
import sys

# Complete the jumpingOnClouds function below.
def jumpingOnClouds(c):
ans = 0
p = len(c)-1
while(p>0):
if(p-2 >=0 and c[p-2]==0):
p = p-2
ans += 1
else:
p = p-1
ans += 1
return ans
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')

n = int(input())

c = list(map(int, input().rstrip().split()))

result = jumpingOnClouds(c)

fptr.write(str(result) + '\n')

fptr.close()