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.

Revisions

  1. achikin revised this gist Oct 5, 2022. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion assignment.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    Given social network posts in the following format
    Given social network posts in the following format:
    ```
    [
    {"date": "12.10.2019",
    @@ -29,6 +29,7 @@ Example:
    {"date": "21.12.2019",
    "text": "Fish!",
    "likes": [1, 2]},
    {"date": "21.12.2019",
    "text": "Apples :((",
    "likes": [1, 2, 3]}
    @@ -47,5 +48,7 @@ The result should be:
    ["Mary", "John"]
    ```

    Any questions are welcome!

    ### Useful hints
    - You can use https://github.com/dakrone/cheshire to parse json files
  2. achikin revised this gist Oct 5, 2022. 2 changed files with 12 additions and 8 deletions.
    4 changes: 4 additions & 0 deletions assignment.md
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,10 @@ Given social network posts in the following format
    {"date": "12.10.2019",
    "text": "I love trouts!",
    "likes": [1, 2, 3, 4]},
    {"date": "17.10.2019",
    "text": "Hello world!",
    "likes": [1, 2, 3, 4]}б
    ...
    ]
    ```
    16 changes: 8 additions & 8 deletions posts.json
    Original file line number Diff line number Diff line change
    @@ -5,37 +5,37 @@
    "likes": [2, 3, 6]},

    {"id": 2,
    "date": "12.10.2019",
    "date": "15.10.2019",
    "text": "I hate apples",
    "likes": [6, 1, 2, 3, 4]},

    {"id": 3,
    "date": "12.10.2019",
    "text": "I bought iPhone.",
    "date": "23.12.2019",
    "text": "I bought an iPhone.",
    "likes": [6, 2]},

    {"id": 4,
    "date": "12.10.2019",
    "date": "02.02.2020",
    "text": "Vote for spaghetti!",
    "likes": [5, 1, 3, 6, 2]},

    {"id": 5,
    "date": "12.10.2019",
    "date": "31.05.2020",
    "text": "How do you like the last Marvell movie?",
    "likes": [2, 6, 1]},

    {"id": 6,
    "date": "12.10.2019",
    "date": "01.01.2022",
    "text": "I hate fish.",
    "likes": [3, 4, 6, 2]},

    {"id": 7,
    "date": "12.10.2019",
    "date": "31.12.2022",
    "text": "I saw the Bigfoot on my backyard.",
    "likes": [4, 1, 2, 6]},

    {"id": 8,
    "date": "12.10.2019",
    "date": "01.03.2019",
    "text": "I'm having fun in Paris",
    "likes": [1, 2, 3, 4, 5, 6]},

  3. achikin revised this gist Dec 17, 2019. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion assignment.md
    Original file line number Diff line number Diff line change
    @@ -41,4 +41,7 @@ Example:
    The result should be:
    ["Mary", "John"]
    ```
    ```

    ### Useful hints
    - You can use https://github.com/dakrone/cheshire to parse json files
  4. achikin revised this gist Dec 17, 2019. 1 changed file with 7 additions and 5 deletions.
    12 changes: 7 additions & 5 deletions assignment.md
    Original file line number Diff line number Diff line change
    @@ -22,10 +22,12 @@ Example:
    ```
    // posts
    [
    {...
    {"date": "21.12.2019",
    "text": "Fish!",
    "likes": [1, 2]},
    {...
    "likes": [2, 3]}
    {"date": "21.12.2019",
    "text": "Apples :((",
    "likes": [1, 2, 3]}
    ]
    //users
    [
    @@ -37,6 +39,6 @@ Example:
    "name": "Jane"},
    ]
    The result should be
    ["Mary"]
    The result should be:
    ["Mary", "John"]
    ```
  5. achikin revised this gist Dec 17, 2019. 2 changed files with 55 additions and 0 deletions.
    46 changes: 46 additions & 0 deletions posts.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    [
    {"id": 1,
    "date": "12.10.2019",
    "text": "I like fish.",
    "likes": [2, 3, 6]},

    {"id": 2,
    "date": "12.10.2019",
    "text": "I hate apples",
    "likes": [6, 1, 2, 3, 4]},

    {"id": 3,
    "date": "12.10.2019",
    "text": "I bought iPhone.",
    "likes": [6, 2]},

    {"id": 4,
    "date": "12.10.2019",
    "text": "Vote for spaghetti!",
    "likes": [5, 1, 3, 6, 2]},

    {"id": 5,
    "date": "12.10.2019",
    "text": "How do you like the last Marvell movie?",
    "likes": [2, 6, 1]},

    {"id": 6,
    "date": "12.10.2019",
    "text": "I hate fish.",
    "likes": [3, 4, 6, 2]},

    {"id": 7,
    "date": "12.10.2019",
    "text": "I saw the Bigfoot on my backyard.",
    "likes": [4, 1, 2, 6]},

    {"id": 8,
    "date": "12.10.2019",
    "text": "I'm having fun in Paris",
    "likes": [1, 2, 3, 4, 5, 6]},

    {"id": 9,
    "date": "12.10.2019",
    "text": "Check out my new clojure library github.com/user/clojure-library",
    "likes": [6, 1, 2, 3, 4]}
    ]
    9 changes: 9 additions & 0 deletions users.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    [
    {"id": 1, "name": "John"},
    {"id": 2, "name": "Mary"},
    {"id": 3, "name": "Anton"},
    {"id": 4, "name": "Batman"},
    {"id": 5, "name": "Jesica"},
    {"id": 6, "name": "Ivan"},
    {"id": 7, "name": "Petra"}
    ]
  6. achikin revised this gist Dec 17, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions assignment.md
    Original file line number Diff line number Diff line change
    @@ -12,8 +12,8 @@ Given social network posts in the following format
    And given users in the following format
    ```
    [
    {:id 1
    :name "John"},
    {"id": 1
    "name": "John"},
    ...
    ]
    ```
  7. achikin revised this gist Dec 17, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion assignment.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,8 @@ Given social network posts in the following format
    ]
    ```
    `likes` is a list of user ids that liked a post
    And users in the following format

    And given users in the following format
    ```
    [
    {:id 1
  8. achikin revised this gist Dec 17, 2019. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions assignment.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,13 @@
    Given social network posts in the following format
    ```json
    ```
    [
    {"date": "12.10.2019",
    "text": "I love trouts!",
    "likes": [1, 2, 3, 4]}, // likes is a list of users' ids that liked a post
    "likes": [1, 2, 3, 4]},
    ...
    ]
    ```
    `likes` is a list of user ids that liked a post
    And users in the following format
    ```
    [
  9. achikin revised this gist Dec 17, 2019. 1 changed file with 40 additions and 1 deletion.
    41 changes: 40 additions & 1 deletion assignment.md
    Original file line number Diff line number Diff line change
    @@ -1 +1,40 @@
    1
    Given social network posts in the following format
    ```json
    [
    {"date": "12.10.2019",
    "text": "I love trouts!",
    "likes": [1, 2, 3, 4]}, // likes is a list of users' ids that liked a post
    ...
    ]
    ```
    And 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"]
    ```
  10. achikin created this gist Dec 17, 2019.
    1 change: 1 addition & 0 deletions assignment.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    1