Title: New puzzle: next permutation in lexicographical order · Issue #7 · microsoft/PythonProgrammingPuzzles · GitHub
Open Graph Title: New puzzle: next permutation in lexicographical order · Issue #7 · microsoft/PythonProgrammingPuzzles
X Title: New puzzle: next permutation in lexicographical order · Issue #7 · microsoft/PythonProgrammingPuzzles
Description: def sat(nx: List[int], x=[1, 2, 4, 3]): """Find the next permutation of a given list by lexicographical ordering.""" import itertools assert len(x) == len(nx) and set(x) == set(nx) return x < nx and all([list(perm) <= x or list(perm) >= ...
Open Graph Description: def sat(nx: List[int], x=[1, 2, 4, 3]): """Find the next permutation of a given list by lexicographical ordering.""" import itertools assert len(x) == len(nx) and set(x) == set(nx) return x < nx an...
X Description: def sat(nx: List[int], x=[1, 2, 4, 3]): """Find the next permutation of a given list by lexicographical ordering.""" import itertools assert len(x) == len(nx) and set(...
Opengraph URL: https://github.com/microsoft/PythonProgrammingPuzzles/issues/7
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"New puzzle: next permutation in lexicographical order","articleBody":"```python\r\ndef sat(nx: List[int], x=[1, 2, 4, 3]): \r\n \"\"\"Find the next permutation of a given list by lexicographical ordering.\"\"\"\r\n import itertools\r\n assert len(x) == len(nx) and set(x) == set(nx)\r\n return x \u003c nx and all([list(perm) \u003c= x or list(perm) \u003e= nx for perm in list(itertools.permutations(x))])\r\n```\r\n\r\n\u003cdetails\u003e\u003csummary\u003eReveal solution\u003c/summary\u003e\r\n\r\n```python\r\ndef sol():\r\n return [1, 3, 2, 4]\r\n```\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e\u003csummary\u003eReveal solution\u003c/summary\u003e\r\n\r\n```python\r\ndef sol():\r\n import itertools\r\n perms = sorted([list(p) for p in list(itertools.permutations(x))])\r\n return perms[perms.index(x) + 1]\r\n```\r\n\u003c/details\u003e\r\n\r\nSolvers, post your solutions in the comments using the following formatting:\r\n````\r\n\u003cdetails\u003e\u003csummary\u003eReveal solution\u003c/summary\u003e\r\n\r\n```python\r\ndef sol():\r\n return \"world\" # replace with your solution\r\n```\r\n\u003c/details\u003e\r\n````\r\n","author":{"url":"https://github.com/TalSchuster","@type":"Person","name":"TalSchuster"},"datePublished":"2021-06-17T19:00:54.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/7/PythonProgrammingPuzzles/issues/7"}
| 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:804fdd15-b129-643d-7d9c-71cf4d261f90 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C1F0:37CBB2:1F3BC87:294A2FF:696EEE8D |
| html-safe-nonce | d4c1c22e0028cf328cba7b77e0de8d4a59709b028956e568c53e820efc06e2f0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMUYwOjM3Q0JCMjoxRjNCQzg3OjI5NEEyRkY6Njk2RUVFOEQiLCJ2aXNpdG9yX2lkIjoiNjk5NTc4MDE1MDk3MjMxMzIyOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a97df4c64b52c45360c2109a97d098b132b1af146c0b3c38944395e1f09c9435 |
| hovercard-subject-tag | issue:924241893 |
| 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/microsoft/PythonProgrammingPuzzles/7/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f395725d88459ae5ba0673fdab93c4442fd00a72c19d7eebc279f0d689c365cc/microsoft/PythonProgrammingPuzzles/issues/7 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f395725d88459ae5ba0673fdab93c4442fd00a72c19d7eebc279f0d689c365cc/microsoft/PythonProgrammingPuzzles/issues/7 |
| og:image:alt | def sat(nx: List[int], x=[1, 2, 4, 3]): """Find the next permutation of a given list by lexicographical ordering.""" import itertools assert len(x) == len(nx) and set(x) == set(nx) return x < nx an... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | TalSchuster |
| hostname | github.com |
| expected-hostname | github.com |
| None | b278ad162d35332b6de714dfb005de04386c4d92df6475522bef910f491a35ee |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/PythonProgrammingPuzzles git https://github.com/microsoft/PythonProgrammingPuzzles.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 361538358 |
| octolytics-dimension-repository_nwo | microsoft/PythonProgrammingPuzzles |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 361538358 |
| octolytics-dimension-repository_network_root_nwo | microsoft/PythonProgrammingPuzzles |
| 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 | 39aed5006635ab6f45e6b77d23e73b08a00272a3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width