René's URL Explorer Experiment


Title: 22.括号生成 · Issue #2 · feikerwu/algorithm-camp · GitHub

Open Graph Title: 22.括号生成 · Issue #2 · feikerwu/algorithm-camp

X Title: 22.括号生成 · Issue #2 · feikerwu/algorithm-camp

Description: 原题地址 给出 n 代表生成括号的对数,请你写出一个函数,使其能够生成所有可能的并且有效的括号组合。 例如,给出 n = 3,生成结果为: [ "((()))", "(()())", "(())()", "()(())", "()()()" ] 解法 动态规划 n对合法括号可以通过以下形式构造 f(n) = '(' + f(p) + ')' + f(q) /** * @param {number} n * @return {string[]} */ var genera...

Open Graph Description: 原题地址 给出 n 代表生成括号的对数,请你写出一个函数,使其能够生成所有可能的并且有效的括号组合。 例如,给出 n = 3,生成结果为: [ "((()))", "(()())", "(())()", "()(())", "()()()" ] 解法 动态规划 n对合法括号可以通过以下形式构造 f(n) = '(' + f(p) + ')' + f(q) /** * @param {numb...

X Description: 原题地址 给出 n 代表生成括号的对数,请你写出一个函数,使其能够生成所有可能的并且有效的括号组合。 例如,给出 n = 3,生成结果为: [ "((()))", "(()())", "(())()", "()(())", "()()()" ] 解法 动态规划 n对合法括号可以通过以下形式构造...

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

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"22.括号生成","articleBody":"[原题地址](https://leetcode-cn.com/problems/generate-parentheses/)\r\n\r\n给出 n 代表生成括号的对数,请你写出一个函数,使其能够生成所有可能的并且有效的括号组合。\r\n例如,给出 n = 3,生成结果为:\r\n```\r\n[\r\n  \"((()))\",\r\n  \"(()())\",\r\n  \"(())()\",\r\n  \"()(())\",\r\n  \"()()()\"\r\n]\r\n```\r\n\r\n### 解法\r\n#### 动态规划\r\nn对合法括号可以通过以下形式构造\r\nf(n) = '(' + f(p) + ')' + f(q)\r\n\r\n``` js\r\n/**\r\n * @param {number} n\r\n * @return {string[]}\r\n */\r\nvar generateParenthesis = function(n) {\r\n  let map = new Array(n + 1).map(item =\u003e [])\r\n  map[0] = [''];\r\n  map[1] = ['()'];\r\n  for (let i = 2; i \u003c= n; i++) {\r\n    let cur = []\r\n    for (let j = 0; j \u003c i; j++) {\r\n      let left = map[j]\r\n      let right = map[i - 1 - j \u003e 0 ? i - 1 - j : 0]\r\n      for (let k = 0; k \u003c left.length; k++) {\r\n        for (let m = 0; m \u003c right.length; m++) {\r\n          cur.push(`(${left[k]})${right[m]}`)\r\n        }\r\n      }\r\n    }\r\n    map[i] = cur;\r\n  }\r\n\r\n  return map[n]\r\n};\r\n```\r\n\r\n#### 深搜回溯\r\n\r\n要去构造一个合法括号序列,只需要保证\r\n1. left大于等于right\r\n2. 当left === right时,下一个括号必须是左括号\r\n其中left是左括号数量,right是右括号数量\r\n\r\n```js\r\n// @lc code=start\r\n/**\r\n * @param {number} n\r\n * @return {string[]}\r\n */\r\nvar generateParenthesis = function(n) {\r\n  let res = []\r\n  solve(0, 0, '');\r\n  return res;\r\n\r\n  function solve(left, right, cur) {\r\n    if (left === n \u0026\u0026 right === n) {\r\n      res.push(cur)\r\n      return\r\n    }\r\n\r\n    if (left \u003e= right) {\r\n      if (left \u003e right) {\r\n        left \u003c n \u0026\u0026 solve(left + 1, right, cur + '(')\r\n        right \u003c n \u0026\u0026 solve(left, right + 1, cur + ')')\r\n      } else {\r\n        left \u003c n \u0026\u0026 solve(left + 1, right, cur + '(')\r\n      }\r\n    }\r\n  }\r\n};\r\n```\r\n\r\n\r\n\r\n\r\n\r\n\r\n","author":{"url":"https://github.com/feikerwu","@type":"Person","name":"feikerwu"},"datePublished":"2020-02-26T07:44:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2/algorithm-camp/issues/2"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:2b28f977-212c-3212-5b37-72b5ff3d3dd5
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAA30:10305:9424AE:C5FF16:69795772
html-safe-nonce9790a83c656d6d02ca68dde7b92756de1e679d8072703091a520ea611787cc3d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQTMwOjEwMzA1Ojk0MjRBRTpDNUZGMTY6Njk3OTU3NzIiLCJ2aXNpdG9yX2lkIjoiNzg5NTE4NjQzMDYzNDg0MTk3MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac72588991d877618003805d1b519ce32dcbe20b1dd00a83cf76040c1f2e698f5e
hovercard-subject-tagissue:571130091
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/2/issue_layout
twitter:imagehttps://opengraph.githubassets.com/a14cd25d6c823488224d5375471d6acfa383fa946b289a095f6409a9e5868caa/feikerwu/algorithm-camp/issues/2
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/a14cd25d6c823488224d5375471d6acfa383fa946b289a095f6409a9e5868caa/feikerwu/algorithm-camp/issues/2
og:image:alt原题地址 给出 n 代表生成括号的对数,请你写出一个函数,使其能够生成所有可能的并且有效的括号组合。 例如,给出 n = 3,生成结果为: [ "((()))", "(()())", "(())()", "()(())", "()()()" ] 解法 动态规划 n对合法括号可以通过以下形式构造 f(n) = '(' + f(p) + ')' + f(q) /** * @param {numb...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamefeikerwu
hostnamegithub.com
expected-hostnamegithub.com
None1f37d980f1b4aca279ebfb66c14d7813792118b07615b2dc3224c6555f933a37
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
release13aeacf8f907ad2c64257f6161f63d056b619a31
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/issues/2#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%2F2
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%2F2
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/2
Reloadhttps://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/issues/2
Reloadhttps://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/issues/2
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/2
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/feikerwu/algorithm-camp/issues/2
22.括号生成https://patch-diff.githubusercontent.com/feikerwu/algorithm-camp/issues/2#top
leetcodehttps://github.com/feikerwu/algorithm-camp/issues?q=state%3Aopen%20label%3A%22leetcode%22
https://github.com/feikerwu
https://github.com/feikerwu
feikerwuhttps://github.com/feikerwu
on Feb 26, 2020https://github.com/feikerwu/algorithm-camp/issues/2#issue-571130091
原题地址https://leetcode-cn.com/problems/generate-parentheses/
leetcodehttps://github.com/feikerwu/algorithm-camp/issues?q=state%3Aopen%20label%3A%22leetcode%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.