We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I know we should group challenge_id because only do this I can get the correct answer. However, I still don't understand why is that?
In my opinion, even though the challenge_id have repeition, this dosen't matter because we just want the summation.
For example:
we have:
contest1 challenge_id1 total_view = 1
contest1 challenge_id1 total_view = 2
contest1 challange_id2 total_view = 3
sum(total_views) is 1+2+3 = 6
and sum stats group by challenge_id and then sum group by contest is (1+2= 3, 3), 3+3 = 6
I think they are the same
Even though we may have null values when left join, the null value will be ignore.
So why this not correct?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Interviews
You are viewing a single comment's thread. Return to all comments →
I know we should group challenge_id because only do this I can get the correct answer. However, I still don't understand why is that? In my opinion, even though the challenge_id have repeition, this dosen't matter because we just want the summation. For example: we have: contest1 challenge_id1 total_view = 1 contest1 challenge_id1 total_view = 2 contest1 challange_id2 total_view = 3
sum(total_views) is 1+2+3 = 6 and sum stats group by challenge_id and then sum group by contest is (1+2= 3, 3), 3+3 = 6 I think they are the same Even though we may have null values when left join, the null value will be ignore.
So why this not correct?