Skip to content

Instantly share code, notes, and snippets.

def fill_tiles(N):
a=b=1
for _ in range(N):
a,b=b,a+b
return a
print(fill_tiles(12))
def bfs(graph, root):
visited = []
queue = [root]
while queue:
node = queue.pop(0)
if node not in visited:
visited.append(node)
queue.extand(graph[node])
return visited
@jc3wrld999
jc3wrld999 / binary_search.py
Last active March 20, 2023 09:56
alogoriothms-python
def binary_search(arr, x):
if len(arr) == 0:
return False
elif len(arr) == 1:
return True if arr[0] == x else False
mid = len(arr)//2
if arr[mid] == x:
return True
elif arr[mid] > x: