Puzzle must have tiles and a final state.
Example:
SMALL_GAME_FINAL = (
'RB',
'BR'
)
# Get device (sd card) | |
diskutil list | |
# Unmount all partition from device. Example /dev/disk6 | |
sudo diskutil unmountDisk /dev/disk6 | |
# Make a directory to mount to | |
sudo mkdir /Volumes/msdos | |
# Mount. /dev/disk6 become /dev/disk6s1 | |
sudo mount -w -t msdos /dev/disk6s1 /Volumes/msdos | |
# Eject when done | |
sudo diskutil unmount force /dev/disk6s1 |
import java.lang.IndexOutOfBoundsException | |
abstract class Node { | |
var length: Int = 0 | |
abstract fun charAt(index: Int): Char | |
abstract fun subString(start: Int, end: Int): String | |
abstract fun delete(index: Int) | |
} |
from abc import ABC, abstractmethod | |
class Node(ABC): | |
length: int = 0 | |
@abstractmethod | |
def char_at(self, index: int) -> str: | |
raise IndexError() | |
@abstractmethod |
const wait = async (time) => new Promise((resolve) => setTimeout(resolve, time)); | |
const pickAll = async () => { | |
const btns = document.querySelectorAll('button[data-test="pab-item-btn-pick"]'); | |
for (const btn of btns) { | |
btn.click(); | |
await wait(100); | |
} | |
} |
interface Queue<T> { | |
append(item: T); | |
appendLeft(item: T); | |
count(): number; | |
peak(): T; | |
peakLeft(): T; | |
pop(): T; | |
popLeft(): T; | |
clear(); | |
[Symbol.iterator](); |
type InputWithIndex<I> = [I, number]; | |
async function parallelMap<I, O>(inputs: I[], asyncMapper: (...input: I[]) => O, concurrencyLimit: number = 5): Promise<O[]> { | |
concurrencyLimit = Math.max(1, concurrencyLimit); | |
const inputStack: InputWithIndex<I>[] = inputs.map((input: I, index: number): InputWithIndex<I> => [input, index]).reverse(); | |
const results = new Array(inputs.length).fill(undefined); | |
const workers = new Array(concurrencyLimit).fill(undefined); | |
async function work() { | |
if (inputStack.length) { |
def clean_comment(sql: str) -> str: | |
lines = sql.split('\n') | |
output = [] | |
for line in lines: | |
escape = False | |
quote = False | |
i = 0 | |
buffer = [] | |
n = len(line) |
from random import randint | |
def split(nums): | |
total = sum(nums) | |
if total % 2 != 0: | |
return False | |
half = total // 2 | |
sub_sum = 0 | |
for i, num in enumerate(nums): | |
sub_sum += num |