Skip to content

Instantly share code, notes, and snippets.

View gbazilio's full-sized avatar

Guilherme Bazilio gbazilio

View GitHub Profile
@gbazilio
gbazilio / cyclic-rotation.py
Created January 4, 2017 17:31
Codility - Cyclic Rotation
def solution(A, K):
A_length = len(A)
new_A_array = [0] * A_length
for index in range(A_length):
shift_index = (index+K) % A_length
new_A_array[shift_index] = A[index]
return new_A_array
@gbazilio
gbazilio / binary-gap.py
Last active January 16, 2017 23:29
Codility - Binary Gap
def solution(N):
if N < 0: return 0
binary_string = bin(N)[2:]
max_gap_count = current_gap_count = 0
for index in range(len(binary_string)):
if binary_string[index] == "0":
current_gap_count += 1
else:
@gbazilio
gbazilio / remove_dot_.sh
Created June 3, 2015 19:14
Recursively removing files with ._ prefix. These files are automatically created by Mac OS.
find . -name "._*" -exec rm -rf {} \;