Tesla Interview Question

How do you implement a button denouncing algorithm?