git clone https://github.com/{your-username}/python-algorithms.git
.git checkout -b your_new_branch_name
git add.
git commit -m "your commit message"
git push origin your_new_branch_name
Referance: Competetive programming with python
def sum_total(n):
return int(n*(n+1)/2)
def gcd(a,b):
if a == 0:
return b
return gcd(b%a,a)
def lcm(a,b):
prod = a*b
hcf = gcd(a,b)
return prod//hcf
if n&1 == 1:
print('odd')
else:
print('even')
def multpow(x,y):
return x<<y # x*(2^y)
def divpow(x,y):
return x>>y # x/(2^y)
def ispow(n):
if n <= 0:
return False
x = n
y = not(n & (n-1))
return x and y
def cntbits(n):
cnt = 0
while n:
cnt += 1
n = n & (n-1)
return cnt
def inttobin(n):
return str(bin(n))[2:]
def bintoint(m):
return int(m,2)
def checkpair(arr): # n -> aray
temp = arr[0]
for i in range(1,len(arr)):
temp = temp ^ arr[i]
return temp