Title: #226 - Invert Binary Tree - LeetCode JavaScript Solutions
Open Graph Title: #226 - Invert Binary Tree - LeetCode JavaScript Solutions
X Title: #226 - Invert Binary Tree - LeetCode JavaScript Solutions
Description: Invert a binary tree. ...
Open Graph Description: Invert a binary tree. ...
X Description: Invert a binary tree. ...
Keywords:
Opengraph URL: https://leetcodejavascript.com/solutions/invert-binary-tree
Domain: leetcodejavascript.com
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/invert-binary-tree","name":"#226 - Invert Binary Tree - LeetCode JavaScript Solutions","description":"Invert a binary tree. ...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * Definition for a binary tree node.\n * function TreeNode(val) {\n * this.val = val;\n * this.left = this.right = null;\n * }\n */\n/**\n * @param {TreeNode} node\n * @return {TreeNode}\n */\nvar invertTree = function(node) {\n if (node) [node.left, node.right] = [invertTree(node.right), invertTree(node.left)];\n return node;\n};","keywords":"LeetCode 226, #226 - Invert Binary Tree, Easy, JavaScript solution","learningResourceType":"Code","isAccessibleForFree":true,"educationalLevel":"intermediate","interactivityType":"mixed"}
| author | LeetCodeJavascript.com |
| og:type | article |
| og:image | https://leetcodejavascript.com/og-image.jpg |
| og:site_name | LeetCode JavaScript Solutions |
| twitter:card | summary_large_image |
| twitter:url | https://leetcodejavascript.com/solutions/invert-binary-tree |
| twitter:image | https://leetcodejavascript.com/og-image.jpg |
| twitter:creator | @joshcrozier |
| theme-color | #1f2937 |
Links:
| LeetCodeJavascript.com | https://leetcodejavascript.com/ |
| Star on GitHub | https://github.com/JoshCrozier/leetcode-javascript |
| Back to all solutions | https://leetcodejavascript.com |
| View on LeetCode | https://leetcode.com/problems/invert-binary-tree/ |
| View on GitHub | https://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/0226-invert-binary-tree.js |
| Depth-First Search | https://leetcodejavascript.com/tags/depth-first-search |
| Tree | https://leetcodejavascript.com/tags/tree |
| Breadth-First Search | https://leetcodejavascript.com/tags/breadth-first-search |
| Binary Tree | https://leetcodejavascript.com/tags/binary-tree |
| Josh Crozier | https://joshcrozier.com |
Viewport: width=device-width,initial-scale=1
Robots: index, follow