René's URL Explorer Experiment


Title: 888.公平的糖果交换 · Issue #5 · feikerwu/algorithm-camp · GitHub

Open Graph Title: 888.公平的糖果交换 · Issue #5 · feikerwu/algorithm-camp

X Title: 888.公平的糖果交换 · Issue #5 · feikerwu/algorithm-camp

Description: 原题地址 爱丽丝和鲍勃有不同大小的糖果棒:A[i] 是爱丽丝拥有的第 i 块糖的> 大小,B[j] 是鲍勃拥有的第 j 块糖的大小。 因为他们是朋友,所以他们想交换一个糖果棒,这样交换后,他们都有> 相同的糖果总量。(一个人拥有的糖果总量是他们拥有的糖果棒大小的> 总和。) 返回一个整数数组 ans,其中 ans[0] 是爱丽丝必须交换的糖果棒的大> 小,ans[1] 是 Bob 必须交换的糖果棒的大小。 如果有多个答案,你可以返回其中任何一个。保证答案存在。 题解 题...

Open Graph Description: 原题地址 爱丽丝和鲍勃有不同大小的糖果棒:A[i] 是爱丽丝拥有的第 i 块糖的> 大小,B[j] 是鲍勃拥有的第 j 块糖的大小。 因为他们是朋友,所以他们想交换一个糖果棒,这样交换后,他们都有> 相同的糖果总量。(一个人拥有的糖果总量是他们拥有的糖果棒大小的> 总和。) 返回一个整数数组 ans,其中 ans[0] 是爱丽丝必须交换的糖果棒的大> 小,ans[1] 是 Bob 必须交换的...

X Description: 原题地址 爱丽丝和鲍勃有不同大小的糖果棒:A[i] 是爱丽丝拥有的第 i 块糖的> 大小,B[j] 是鲍勃拥有的第 j 块糖的大小。 因为他们是朋友,所以他们想交换一个糖果棒,这样交换后,他们都有> 相同的糖果总量。(一个人拥有的糖果总量是他们拥有的糖果棒大小的> 总和。) 返回一个整数数组 ans,其中 ans[0] 是爱丽丝必须交换的糖果棒的大> 小,ans[1]...

Opengraph URL: https://github.com/feikerwu/algorithm-camp/issues/5

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"888.公平的糖果交换","articleBody":"[原题地址](https://leetcode-cn.com/problems/fair-candy-swap/)\r\n\r\n\u003e 爱丽丝和鲍勃有不同大小的糖果棒:A[i] 是爱丽丝拥有的第 i 块糖的\u003e 大小,B[j] 是鲍勃拥有的第 j 块糖的大小。\r\n\u003e\r\n\u003e 因为他们是朋友,所以他们想交换一个糖果棒,这样交换后,他们都有\u003e 相同的糖果总量。(一个人拥有的糖果总量是他们拥有的糖果棒大小的\u003e 总和。)\r\n\u003e\r\n\u003e 返回一个整数数组 ans,其中 ans[0] 是爱丽丝必须交换的糖果棒的大\u003e 小,ans[1] 是 Bob 必须交换的糖果棒的大小。\r\n\u003e\r\n\u003e 如果有多个答案,你可以返回其中任何一个。保证答案存在。\r\n\r\n### 题解\r\n题目保证答案存在,交换一次糖果[x, y], A, B 糖果总量即相等\r\n简单的数学推导即可\r\n```\r\n  sumA - x + y = sumB - y + x\r\n=\u003e y = (sumB - sumA) / 2 + x\r\n```\r\n有个小技巧是可以通过Set来较减少寻找y是否在B中出现的时间开销\r\n\r\n时间复杂度 `O(A.length + B.length)`\r\n空间复杂度 `O(B.length)`\r\n\r\n### 代码\r\n```js\r\n/**\r\n * @param {number[]} A\r\n * @param {number[]} B\r\n * @return {number[]}\r\n */\r\nvar fairCandySwap = function(A, B) {\r\n  let sumA = A.reduce((acc, cur) =\u003e acc + cur, 0)\r\n  let sumB = B.reduce((acc, cur) =\u003e acc + cur, 0)\r\n  let setB = new Set(B)\r\n  const term = (sumB - sumA) / 2\r\n  for (let i = 0; i \u003c A.length; i++) {\r\n    let y = term + A[i]\r\n    if (setB.has(y)) {\r\n      return [A[i], y]\r\n    }\r\n  }\r\n};\r\n```","author":{"url":"https://github.com/feikerwu","@type":"Person","name":"feikerwu"},"datePublished":"2020-03-02T04:13:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/5/algorithm-camp/issues/5"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:ed37d33f-2729-4c1b-261e-48113385ceff
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8362:B5FDA:3324EE:438267:69793E45
html-safe-nonce144b3537a79e2f8537510f5b5700d6f669972a09df2759fca0b79dd42c48496e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzYyOkI1RkRBOjMzMjRFRTo0MzgyNjc6Njk3OTNFNDUiLCJ2aXNpdG9yX2lkIjoiMjk0OTYwODk5MzE5MTQ0NDAzNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac1e5720ff6b863b67e3c03e5c730bc7922ba78f4717e85100df59209fa8e945a0
hovercard-subject-tagissue:573703970
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/feikerwu/algorithm-camp/5/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1b2cdca1c328249f086dfc9387441cba913725ba5bc0775bfd47ef4519bf8774/feikerwu/algorithm-camp/issues/5
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1b2cdca1c328249f086dfc9387441cba913725ba5bc0775bfd47ef4519bf8774/feikerwu/algorithm-camp/issues/5
og:image:alt原题地址 爱丽丝和鲍勃有不同大小的糖果棒:A[i] 是爱丽丝拥有的第 i 块糖的> 大小,B[j] 是鲍勃拥有的第 j 块糖的大小。 因为他们是朋友,所以他们想交换一个糖果棒,这样交换后,他们都有> 相同的糖果总量。(一个人拥有的糖果总量是他们拥有的糖果棒大小的> 总和。) 返回一个整数数组 ans,其中 ans[0] 是爱丽丝必须交换的糖果棒的大> 小,ans[1] 是 Bob 必须交换的...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamefeikerwu
hostnamegithub.com
expected-hostnamegithub.com
Nonef9bf80f4f4d71a2f9361692e65b326c887a4b25c15fe127257a2d331d14031bd
turbo-cache-controlno-preview
go-importgithub.com/feikerwu/algorithm-camp git https://github.com/feikerwu/algorithm-camp.git
octolytics-dimension-user_id39146693
octolytics-dimension-user_loginfeikerwu
octolytics-dimension-repository_id242958294
octolytics-dimension-repository_nwofeikerwu/algorithm-camp
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id242958294
octolytics-dimension-repository_network_root_nwofeikerwu/algorithm-camp
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4aabbf3f1d27b754d95d7a9a6e02d14a5aaeb4e6
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/issues/5#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Ffeikerwu%2Falgorithm-camp%2Fissues%2F5
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Ffeikerwu%2Falgorithm-camp%2Fissues%2F5
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=feikerwu%2Falgorithm-camp
Reloadhttps://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/issues/5
Reloadhttps://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/issues/5
Reloadhttps://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/issues/5
feikerwu https://patch-diff.githubusercontent.com/feikerwu
algorithm-camphttps://patch-diff.githubusercontent.com/feikerwu/algorithm-camp
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Ffeikerwu%2Falgorithm-camp
Fork 0 https://patch-diff.githubusercontent.com/login?return_to=%2Ffeikerwu%2Falgorithm-camp
Star 3 https://patch-diff.githubusercontent.com/login?return_to=%2Ffeikerwu%2Falgorithm-camp
Code https://patch-diff.githubusercontent.com/feikerwu/algorithm-camp
Issues 11 https://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/issues
Pull requests 3 https://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/pulls
Actions https://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/actions
Projects 0 https://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/projects
Security 0 https://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/security
Insights https://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/pulse
Code https://patch-diff.githubusercontent.com/feikerwu/algorithm-camp
Issues https://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/issues
Pull requests https://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/pulls
Actions https://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/actions
Projects https://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/projects
Security https://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/security
Insights https://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/feikerwu/algorithm-camp/issues/5
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/feikerwu/algorithm-camp/issues/5
888.公平的糖果交换https://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/issues/5#top
leetcodehttps://github.com/feikerwu/algorithm-camp/issues?q=state%3Aopen%20label%3A%22leetcode%22
mathhttps://github.com/feikerwu/algorithm-camp/issues?q=state%3Aopen%20label%3A%22math%22
https://github.com/feikerwu
https://github.com/feikerwu
feikerwuhttps://github.com/feikerwu
on Mar 2, 2020https://github.com/feikerwu/algorithm-camp/issues/5#issue-573703970
原题地址https://leetcode-cn.com/problems/fair-candy-swap/
leetcodehttps://github.com/feikerwu/algorithm-camp/issues?q=state%3Aopen%20label%3A%22leetcode%22
mathhttps://github.com/feikerwu/algorithm-camp/issues?q=state%3Aopen%20label%3A%22math%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.