Tesla interview question

How do you implement a button denouncing algorithm?