【第二十八天 - 系统设计 介绍】

Q1. 系统设计 是什麽

  • 在业界基本上都是团队开发专案,每个人负责实作部分功能,而 Leetcode 会列出典型的系统设计,学会看到问题时,会使用什麽方式实作

参考资料:https://kknews.cc/career/43q4253.html

Q2. 学会 系统设计 概念可以做什麽 ?

  • 利於团队合作开发,从系统设计题中了解系统间的组件关系、结构关系等。

Lab. 明天要解的题目:355. Design Twitter

  • 题目连结:https://leetcode.com/problems/design-twitter/
  • 题目叙述
    • 设计一个简化版的 twitter,主要实现如下功能:
    • User 可以发布推文
    • User 可以追踪 / 取消追踪其他 User
    • 可以看到一个 User 的 news feed 中,最近 10 篇的推文
  • Twitter class 要包含如下 methods:
    • Constructor
    • void postTweet(int userId, int tweetId)
      • 用来发布推文的 function。
      • 由 ID 为 userId 的 User 发布了 ID 为 tweetId 的推文。
      • 每次 call 这个 function 的 tweetId 必须 unique 。
    • List<Integer> getNewsFeed(int userId)
      • 取得 ID 为 userId 的 User 的 news feed 中最近的 10 篇推文。
      • 每一个推文必须是由该 User 所发布,或是由该 User 追踪的 User 所发布。
      • 必须由最新到最旧排序。
    • void follow(int followerId, int followeeId)
      • 用於让 ID 为 followerId 的 User 追踪 ID 为 followeeId 的 User。
    • void unfollow(int followerId, int followeeId)
      • 用於让 ID 为 followerId 的 User 取消追踪 ID 为 followeeId 的 User。

https://ithelp.ithome.com.tw/upload/images/20210928/20140592nuMfRGaEX7.png

  • 测资的 Input/Output
    • 根据每个函数实作并回传相关资料
    • 不需真的读取["Twitter","postTweet"....]或回传[null,null....],

https://ithelp.ithome.com.tw/upload/images/20210928/20140592b7XaAdgm6z.png

  • 题目的条件
    • userIdfollowerIdfolloweeId 介於 1~500 间
    • tweetId 介於 0~10000
    • 每个 tweets 都有唯一的 ID ,不会重复
    • postTweetgetNewsFeedfollowunfollow函数最多呼叫 30000 次

https://ithelp.ithome.com.tw/upload/images/20210928/20140592i0wJcuNFJU.png


<<:  [ Day 13 ] - 如何透过 DOM 抓取网页元素

>>:  Day13# defer

[Day 27] Web 小迷茫

今天要解的题目和昨天有关联 是他进阶的2.0 没错,又是爱尔兰人 Irish-Name-Repo 2...

STM32开发笔记03---Bit-Banding

架构图 带位操作原理 以往我们在使用暂存器时,都是在操作该暂存器32bits(4bytes)的储存地...

Day24 切版笔记-超通用横式版面

学过的内容没有实际在VS CODE上写过,很难不去忘记。 透过切版练习,逼自己每天都进步一点点,相...

【如何快速学习新技能 ?】软技能 : 十步学习法

学习「怎样学习」 大纲 学习能力 软技能:代码之外的生存指南 十步学习法「概述」 第一部分:「研究」...

Day3 条件判断

今天来学学Vue里面的判别式v-if 跟v-show 1.v - if 在这里我们将条件设定为Sho...