feat(content): function signatures + test cases
This commit is contained in:
@@ -9,6 +9,26 @@ categories:
|
||||
patterns:
|
||||
- heap
|
||||
|
||||
function_signature: "class Twitter:\n def __init__(self): ...\n def post_tweet(self, user_id: int, tweet_id: int) -> None: ...\n def get_news_feed(self, user_id: int) -> list[int]: ...\n def follow(self, follower_id: int, followee_id: int) -> None: ...\n def unfollow(self, follower_id: int, followee_id: int) -> None: ..."
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { operations: ["Twitter", "postTweet", "getNewsFeed", "follow", "postTweet", "getNewsFeed", "unfollow", "getNewsFeed"], arguments: [[], [1, 5], [1], [1, 2], [2, 6], [1], [1, 2], [1]] }
|
||||
expected: [null, null, [5], null, null, [6, 5], null, [5]]
|
||||
- input: { operations: ["Twitter", "postTweet", "postTweet", "getNewsFeed"], arguments: [[], [1, 1], [1, 2], [1]] }
|
||||
expected: [null, null, null, [2, 1]]
|
||||
hidden:
|
||||
- input: { operations: ["Twitter", "getNewsFeed"], arguments: [[], [1]] }
|
||||
expected: [null, []]
|
||||
- input: { operations: ["Twitter", "follow", "getNewsFeed"], arguments: [[], [1, 2], [1]] }
|
||||
expected: [null, null, []]
|
||||
- input: { operations: ["Twitter", "postTweet", "postTweet", "postTweet", "postTweet", "postTweet", "postTweet", "postTweet", "postTweet", "postTweet", "postTweet", "postTweet", "getNewsFeed"], arguments: [[], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [1, 8], [1, 9], [1, 10], [1, 11], [1]] }
|
||||
expected: [null, null, null, null, null, null, null, null, null, null, null, null, [11, 10, 9, 8, 7, 6, 5, 4, 3, 2]]
|
||||
- input: { operations: ["Twitter", "postTweet", "follow", "follow", "unfollow", "getNewsFeed"], arguments: [[], [2, 5], [1, 2], [1, 2], [1, 2], [1]] }
|
||||
expected: [null, null, null, null, null, []]
|
||||
- input: { operations: ["Twitter", "postTweet", "postTweet", "follow", "getNewsFeed"], arguments: [[], [1, 1], [2, 2], [1, 2], [1]] }
|
||||
expected: [null, null, null, null, [2, 1]]
|
||||
|
||||
description: |
|
||||
Design a simplified version of Twitter where users can post tweets, follow/unfollow another user, and is able to see the `10` most recent tweets in the user's news feed.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user