1683. Invalid Tweets

Question:

https://leetcode.com/problems/invalid-tweets/

Solution:

select 
tweet_id
from Tweets
where length(content) > 15

1693. Daily Leads and Partners

Question:

https://leetcode.com/problems/daily-leads-and-partners/

Solution:

select 
date_id, 
make_name,
count(distinct lead_id) as unique_leads,
count(distinct partner_id) as unique_partners
from DailySales
group by 1,2

1699. Number of Calls Between Two Persons

Question:

https://leetcode.com/problems/number-of-calls-between-two-persons/

Solution:

select 
person1, 
person2, 
sum(calls) as call_count, 
sum(duration) as total_duration
from (
    select 
    from_id as person1, 
    to_id as person2, 
    1 as calls, 
    duration
    from Calls
    where from_id < to_id
    union all
    select 
    to_id as person1, 
    from_id as person2, 
    1 as calls, 
    duration
    from Calls
    where to_id < from_id
) c
group by 1,2

Leave a Reply