Skip to content

Instantly share code, notes, and snippets.

@achikin
Last active October 5, 2022 13:51
Show Gist options
  • Select an option

  • Save achikin/ada1a95ad12b38077f47130c2bddd6fe to your computer and use it in GitHub Desktop.

Select an option

Save achikin/ada1a95ad12b38077f47130c2bddd6fe to your computer and use it in GitHub Desktop.
Test assignment

Given social network posts in the following format

[
 {"date": "12.10.2019",
  "text": "I love trouts!",
  "likes": [1, 2, 3, 4]},
  ...
]

likes is a list of user ids that liked a post

And given users in the following format

[
  {:id 1
   :name "John"},
   ...
]

Find the names of the users, that liked all posts. Example:

// posts
[
  {... 
   "likes": [1, 2]},
   {...
    "likes": [2, 3]}
]
//users
[
  {"id": 1,
   "name": "John"},
  {"id": 2,
   "name": "Mary"},
   {"id": 3,
   "name": "Jane"},
]

The result should be
["Mary"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment