Implement a thread-safe in-memory rate limiter using the Sliding Window or Token Bucket algorithm. Interface: type RateLimiter interface { Allow(key string) bool } Requirements: - Limit: N requests per T seconds for one key - Thread-safe implementation - No third-party libraries - Minimize locking - Discuss: - possible race conditions - GC impact - behavior with many keys Input parameters: NewRateLimiter(limit int, window time.Duration)
Golang
What is DNS and how does it work?
What is the difference between a process and a thread at the operating system level?
Given a string containing characters (){}. Determine whether the input string is balanced in terms of brackets.
Can a pod in Kubernetes contain multiple containers with a shared network namespace? How does a pod differ from a container?
What is a transaction?
If binary search and search tree operate in the same time, why do both exist and when should each be used?
Can we create an array whose elements are of different types, for example 1, "A" and false?
Tell me about arrays and slices in Go: how are they similar and what are the differences?
Write tests to check boundary cases for the maximum distance problem solution.
How are interfaces structured in Go?
What does the string data type in Go look like?
What is a collision and how to deal with it?
How can you control the number of threads used for goroutine execution?
What happens if the local queue of one [name] is empty, but another [name] has tasks?
What is deadlock and race condition, how to deal with them?
Write a function that checks if a string is a palindrome. Only alphabetic characters (a-z, A-Z, а-я, А-Я) should be checked, ignoring case.
Do you know the 'man in the middle' attack?
How is the average case evaluated in asymptotic notation?
Is there an open individual entrepreneur or LLC?