Title: 剑指Offer&leetcode295:数据流的中位数 · Issue #63 · sisterAn/JavaScript-Algorithms · GitHub
Open Graph Title: 剑指Offer&leetcode295:数据流的中位数 · Issue #63 · sisterAn/JavaScript-Algorithms
X Title: 剑指Offer&leetcode295:数据流的中位数 · Issue #63 · sisterAn/JavaScript-Algorithms
Description: 中位数是有序列表中间的数。如果列表长度是偶数,中位数则是中间两个数的平均值。 例如, [2,3,4] 的中位数是 3 [2,3] 的中位数是 (2 + 3) / 2 = 2.5 设计一个支持以下两种操作的数据结构: void addNum(int num) - 从数据流中添加一个整数到数据结构中。 double findMedian() - 返回目前所有元素的中位数。 示例: addNum(1) addNum(2) findMedian() -> 1.5 addNum(...
Open Graph Description: 中位数是有序列表中间的数。如果列表长度是偶数,中位数则是中间两个数的平均值。 例如, [2,3,4] 的中位数是 3 [2,3] 的中位数是 (2 + 3) / 2 = 2.5 设计一个支持以下两种操作的数据结构: void addNum(int num) - 从数据流中添加一个整数到数据结构中。 double findMedian() - 返回目前所有元素的中位数。 示例: addNum(...
X Description: 中位数是有序列表中间的数。如果列表长度是偶数,中位数则是中间两个数的平均值。 例如, [2,3,4] 的中位数是 3 [2,3] 的中位数是 (2 + 3) / 2 = 2.5 设计一个支持以下两种操作的数据结构: void addNum(int num) - 从数据流中添加一个整数到数据结构中。 double findMedian() - 返回目前所有元素的中位数。 示例: addNum(...
Opengraph URL: https://github.com/sisterAn/JavaScript-Algorithms/issues/63
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"剑指Offer\u0026leetcode295:数据流的中位数","articleBody":"中位数是有序列表中间的数。如果列表长度是偶数,中位数则是中间两个数的平均值。\r\n\r\n例如,\r\n\r\n`[2,3,4]` 的中位数是 `3`\r\n\r\n`[2,3]` 的中位数是 `(2 + 3) / 2 = 2.5`\r\n\r\n设计一个支持以下两种操作的数据结构:\r\n\r\n- `void addNum(int num) `- 从数据流中添加一个整数到数据结构中。\r\n- `double findMedian()` - 返回目前所有元素的中位数。\r\n\r\n**示例:**\r\n\r\n```js\r\naddNum(1)\r\naddNum(2)\r\nfindMedian() -\u003e 1.5\r\naddNum(3) \r\nfindMedian() -\u003e 2\r\n```\r\n\r\n**进阶:**\r\n\r\n- 如果数据流中所有整数都在 0 到 100 范围内,你将如何优化你的算法?\r\n- 如果数据流中 99% 的整数都在 0 到 100 范围内,你将如何优化你的算法?\r\n\r\n附赠leetcode地址:[leetcode](https://leetcode-cn.com/problems/find-median-from-data-stream/solution/javascriptshu-ju-liu-de-zhong-wei-shu-by-user7746o/)","author":{"url":"https://github.com/sisterAn","@type":"Person","name":"sisterAn"},"datePublished":"2020-06-10T23:40:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/63/JavaScript-Algorithms/issues/63"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0c6394db-c124-223e-4664-84b38ff8ee40 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EDFE:31006B:18592DC:206ACFF:696AEE50 |
| html-safe-nonce | 6d480d150d5f030b1f898785c3a4777a7798063584772cef7c652cf76fc47fdb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFREZFOjMxMDA2QjoxODU5MkRDOjIwNkFDRkY6Njk2QUVFNTAiLCJ2aXNpdG9yX2lkIjoiNTc1NzA2NzY0MDk5NTI0NTY0OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3440a43356a63b36c2a7bf0e2d67939fb300738fa1108d78a9306511026b21a4 |
| hovercard-subject-tag | issue:636613886 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sisterAn/JavaScript-Algorithms/63/issue_layout |
| twitter:image | https://opengraph.githubassets.com/343f58136d7c9e83d873630e39cdf35ea8f247d5054a1bee80d5967e9d5bdd6b/sisterAn/JavaScript-Algorithms/issues/63 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/343f58136d7c9e83d873630e39cdf35ea8f247d5054a1bee80d5967e9d5bdd6b/sisterAn/JavaScript-Algorithms/issues/63 |
| og:image:alt | 中位数是有序列表中间的数。如果列表长度是偶数,中位数则是中间两个数的平均值。 例如, [2,3,4] 的中位数是 3 [2,3] 的中位数是 (2 + 3) / 2 = 2.5 设计一个支持以下两种操作的数据结构: void addNum(int num) - 从数据流中添加一个整数到数据结构中。 double findMedian() - 返回目前所有元素的中位数。 示例: addNum(... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sisterAn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/sisterAn/JavaScript-Algorithms git https://github.com/sisterAn/JavaScript-Algorithms.git |
| octolytics-dimension-user_id | 19721451 |
| octolytics-dimension-user_login | sisterAn |
| octolytics-dimension-repository_id | 252061924 |
| octolytics-dimension-repository_nwo | sisterAn/JavaScript-Algorithms |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 252061924 |
| octolytics-dimension-repository_network_root_nwo | sisterAn/JavaScript-Algorithms |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width