Skip to content

Instantly share code, notes, and snippets.

@mattlevan
mattlevan / spiral_order.py
Created April 20, 2020 18:52
Leetcode 54: Spiral Matrix
"""
Problem: Given a 2D array of integers, create a spiral_copy function
that copies the input matrix's values into a 1D array in spiral order,
clockwise. The function should return only that array and analyze the
time/space complexities after you have a solution.
Solution: Return a 1D spiral copy of the input matrix.
Approach:
1. Extract the width and height of the input matrix into separate variables
@mattlevan
mattlevan / install-apt-packages.sh
Created October 31, 2020 01:17
Install apt packages on multiple computers simultaneously
#!/bin/bash
# Dependencies:
# - Each machine must have openssh-server installed
# - Each machine must have key-based SSH authentication configured
# - Each machine must have
declare -a MACHINES=(
"localhost"
"nonexistent"