Skip to content

Instantly share code, notes, and snippets.

@achyuth1313
achyuth1313 / calculator.py
Last active February 7, 2026 15:39
spreadsheet calculator
import sys
from typing import Union
# mostly assuming valid RPN expressions
class Cell:
def __init__(self, expr, value: Union[float, int]):
self.expr: str = expr
self.value: Union[float, int] = value
@achyuth1313
achyuth1313 / heap.py
Created May 1, 2024 13:22
heap implementation
from typing import List
class MinHeap:
def __init__(self, input_arr):
self.heap = input_arr
startidx = len(self.heap) // 2 - 1
for i in range(startidx, -1, -1):
self._percolate_down(i)