斐波那契(从递归,到优化递归,到迭代)
压缩字符
“ATG” 24bits => 001110 6bits
a = 1
a<<2
a|=0b00
Unbreakable encryption
def decrypt(key1: int, key2: int) -> str:
decrypted: int = key1 ^ key2 # XOR
temp: bytes = decrypted.to_bytes((decrypted.bit_length()+ 7) // 8, "big")
return temp.decode()
Calculating PI
π = 4/1 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11…
汉诺塔
1 Move the upper n-1 discs from tower A to B (the temporary tower), using C as
the in-between.
2 Move the single lowest disc from A to C.
3 Move the n-1 discs from tower B to C, using A as the in-between.