Skip to content

Instantly share code, notes, and snippets.

@fenilgandhi
Last active February 12, 2024 06:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fenilgandhi/47fd9e2596ee68313023cdc3fdf61c25 to your computer and use it in GitHub Desktop.
Save fenilgandhi/47fd9e2596ee68313023cdc3fdf61c25 to your computer and use it in GitHub Desktop.
"""
You are given with two lists, popular_products_ids and viewed_products_ids
- The first list is the list of ids of all popular products that any user would like to view
sorted on their popularity in descending order
- The second list is a list of ids of all products that this user has already viewed.
- Write a function get_fresh_products which return the products which are not yet viewed by
the user while maintaining the sorted order of popularity in an efficient manner
"""
popular_products_ids = list(map(id, range(50000)))
liked_products_ids = list(map(id, range(10000)))
# Add function definition here
def get_fresh_products(popular_products_ids, liked_products_ids):
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment