NewProject Coding is here — build features and fix bugs in real codebases with an AI assistantSee what's new

Table: Calls

+----------------+--------------+
| Column Name    | Type         |
+----------------+--------------+
| call_id        | INT          |
| caller_id      | INT          |
| recipient_id   | INT          |
| call_type      | VARCHAR(255) |
| call_timestamp | DATE         |
+----------------+--------------+

Each row represents a call from a caller to a recipient.

Table: Users

+-------------+--------------+
| Column Name | Type         |
+-------------+--------------+
| user_id     | INT          |
| country     | VARCHAR(255) |
+-------------+--------------+

Each row contains a user's country.

Use the seven calendar dates ending on the maximum call date. The eligible population is every distinct caller or recipient in that window. Return the percentage of eligible users who initiated more than 10 calls. Round the 0 to 100 percentage to 2 decimals and return 0 for empty input.

Return the result table in any order.

The result format is shown below.

Example

Input:

Calls table:
+---------+-----------+--------------+-----------+----------------+
| call_id | caller_id | recipient_id | call_type | call_timestamp |
+---------+-----------+--------------+-----------+----------------+
| 1       | 1         | 2            | voice     | 2026-08-30     |
| 2       | 1         | 2            | voice     | 2026-08-30     |
| 3       | 1         | 2            | voice     | 2026-08-30     |
| 4       | 1         | 2            | voice     | 2026-08-30     |
| 5       | 1         | 2            | voice     | 2026-08-30     |
| 6       | 1         | 2            | voice     | 2026-08-30     |
| 7       | 1         | 2            | voice     | 2026-08-30     |
| 8       | 1         | 2            | voice     | 2026-08-30     |
| 9       | 1         | 2            | voice     | 2026-08-30     |
| 10      | 1         | 2            | voice     | 2026-08-30     |
| 11      | 1         | 2            | voice     | 2026-08-30     |
| 12      | 3         | 2            | video     | 2026-08-30     |
+---------+-----------+--------------+-----------+----------------+

Output:

+----------+
| user_pct |
+----------+
| 33.33    |
+----------+

Explanation:
User 1 initiated eleven calls and qualifies. Users 2 and 3 are also participants, so one of three eligible users qualifies.


Accepted
1/1
Acceptance Rate100.0%
Test Cases
Input
-
Output
-
Expected
-