#462 Implement a Limit Checking System
You are a backend developer at a fintech company. The company provides payment services and must enforce user limits. A product owner asks you to create a system that checks limits before payments are processed.
Definitions
Payment:
- Amount in rubles;
- Operation type, debit only;
-
timestamp.
User limits:
- Daily amount limit.
- Maximum amount of a single operation;
Operation history:
- A list of the user's completed payments.
Exercise
Implement a limit checking system that:
-
Accepts a payment and a user
id; - Checks all configured limits;
- Returns whether the operation may be performed;
- If it cannot be performed, returns the reason and identifies which limit was exceeded.
Constraints
For this exercise, assume that all payments for the same user are processed strictly sequentially. No payment for that user can be processed while the limit check is running.
Question review
Sign in to start the dialogue
The mentor keeps the context of the current question and your previous messages.
Sign in
Available with Premium
This is just one of the solutions available with Premium. And more:
- 250+ advanced lectures
- 1300+ practice exercises
- 500+ solutions to problems from real interviews
- Personalized Java Hub certificates
- Expanded access to the AI mentor