Comments you can see
Write code · Basic · §4.1 Remembering what you have seen
comments holds the IDs of the people who wrote the comments on a post, in the order the comments were written: comments[i] is the ID of the person who wrote comment i. blocked holds the IDs of the people you have blocked, and the same ID may appear more than once in blocked.
You cannot see the comments written by people you have blocked. Complete the function solution, which returns the number of comments you can see.
Function
solution(comments, blocked)
Constraints
- The lengths of
commentsandblockedare each from 1 to 100,000. - Each ID is a string of lowercase English letters and digits, with a length from 1 to 20.
Examples
| comments | blocked | result |
|---|---|---|
['kim', 'lee', 'park', 'lee', 'choi'] | ['lee'] | 3 |
['sun', 'moon'] | ['star'] | 2 |
Starter code
def solution(comments, blocked):
answer = 0
return answerSolve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.