Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a program that implements the "debounce" function to control how often a function is executed.

Medium

Problem Statement

Write a program that implements the "debounce" function to control how often a function is executed.

Sample Input

Simulate a button click every 500ms, with a debounce time of 2000ms.

Sample Output

Button clicked!

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
// Predefined structure function debounce(func: () => void, delay: number): () => void { // Your logic here } // Simulate calls
Log in or sign up to run or submit your code.Log inSign up
Input
Simulate a button click every 500ms, with a debounce time of 2000ms.
Expected Output
Button clicked!