Skip to content

Practice Daily Leads and Partners

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1693
LeetCode Problem

Daily Leads and Partners

Problem Statement

Tables: DailySales(date_id DATE, make_name VARCHAR, lead_id INT, partner_id INT). DailySales permits duplicate rows. make_name contains lowercase English letters. For each date_id and make_name, return unique_leads as the number of distinct lead_id values and unique_partners as the number of distinct partner_id values. Count each column independently rather than distinct lead-partner pairs. Output order is unrestricted.

Source: Daily Leads and Partners on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
DailySales table: +-----------+-----------+---------+------------+ | date_id   | make_name | lead_id | partner_id | +-----------+-----------+---------+------------+ | 2020-12-8 | toyota    | 0       | 1          | | 2020-12-8 | toyota    | 1       | 0          | | 2020-12-8 | toyota    | 1       | 2          | | 2020-12-7 | toyota    | 0       | 2          | | 2020-12-7 | toyota    | 0       | 1          | | 2020-12-8 | honda     | 1       | 2          | | 2020-12-8 | honda     | 2       | 1          | | 2020-12-7 | honda     | 0       | 1          | | 2020-12-7 | honda     | 1       | 2          | | 2020-12-7 | honda     | 2       | 1          | +-----------+-----------+---------+------------+
Output
+-----------+-----------+--------------+-----------------+ | date_id   | make_name | unique_leads | unique_partners | +-----------+-----------+--------------+-----------------+ | 2020-12-8 | toyota    | 2            | 3               | | 2020-12-7 | toyota    | 1            | 2               | | 2020-12-8 | honda     | 2            | 2               | | 2020-12-7 | honda     | 3            | 2               | +-----------+-----------+--------------+-----------------+

Related LeetCode Problems

Practice more problems similar to Daily Leads and Partners.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.