Skip to content

Instantly share code, notes, and snippets.

View vadimyen's full-sized avatar
🎯
Focusing

Vadim vadimyen

🎯
Focusing
View GitHub Profile
@vadimyen
vadimyen / solveRPN.ts
Last active May 2, 2024 17:41
Calculate reversed Polish notation in Typescript
type Operation = (a: number, b: number) => number
type OperationDenotation = keyof typeof operationMap
const operationMap = {
"+": (a, b) => a + b,
"-": (a, b) => b - a,
"*": (a, b) => a * b,
"/": (a, b) => b / a
} satisfies Record<string, Operation>