Skip to content

Instantly share code, notes, and snippets.

View 43061b4a's full-sized avatar
🐌

AR 43061b4a

🐌
  • Calgary, Canada
View GitHub Profile
def solution(A):
# write your code in Python 2.7
diffs = []
sum_a = 0
for i in range(len(A)):
sum_a += A[i]
sum_b = 0
for i in range(0, len(A)-1):
sum_b += A[i]
import math
def solution(X, Y, D):
if D < 0:
return 0
steps = math.ceil((abs(Y-X)) / float(D))
print steps
steps = int(steps)
return steps
# you can use print for debugging purposes, e.g.
# print "this is a debug message"
def solution(A):
m = len(A) + 1
expected_sum = (m * (m+1)) / 2
return expected_sum - sum(A)
# https://codility.com/demo/results/demo4C4YQX-MX2/
# O(N) or O(N * log(N))
# you can use print for debugging purposes, e.g.
# print "this is a debug message"
def solution(X, A):
if len(A) <= 0 or X <= 0:
return -1
d = dict(zip(range(1, X+1), [0] * (X+1)))
# you can use print for debugging purposes, e.g.
# print "this is a debug message"
def solution(A):
d = dict(zip(range(1, len(A) + 1), [0] * (len(A) + 1) ))
result = 0
for i in A:
if i in d:
d.pop(i)
if not d:
result = 1
def solution(A):
d = {}
result = 0
for i in range(len(A)):
if A[i] not in d and A[i] >= 1:
d[A[i]] = 0
j = 1
while j <= 100010:
if not j in d:
result = j
#!/usr/bin/env python
def solution(N, A):
counters = [0] * N
max_counter = 0
all_inc = 0
N1 = N + 1
for i in range(len(A)):
#https://codility.com/demo/results/demoRPXRJY-QA4/
def solution(A, B, K):
result = B // K - A // K
if A % K == 0: # Additional one
result += 1
return result
# https://codility.com/demo/results/demoHUQZ5G-SSR/
def solution(A):
if len(A) <= 0:
return -1
result = 0
multiplier = 0
for i in range(len(A)):
if A[i] == 0:
multiplier += 1
else:
### Keybase proof
I hereby claim:
* I am arastogi19 on github.
* I am halite (https://keybase.io/halite) on keybase.
* I have a public key ASCLQWEfIXRfxPeuS6LzN6jRO5MSU-BEtV7iCp6nb09fFQo
To claim this, I am signing this object: