René's URL Explorer Experiment


Title: #1243 - Array Transformation - LeetCode JavaScript Solutions

Open Graph Title: #1243 - Array Transformation - LeetCode JavaScript Solutions

X Title: #1243 - Array Transformation - LeetCode JavaScript Solutions

Description: Given an initial array arr, every day you produce a new array using the array of the previous day. On the i-th day, you do the following ope...

Open Graph Description: Given an initial array arr, every day you produce a new array using the array of the previous day. On the i-th day, you do the following ope...

X Description: Given an initial array arr, every day you produce a new array using the array of the previous day. On the i-th day, you do the following ope...

Keywords:

Opengraph URL: https://leetcodejavascript.com/solutions/array-transformation

direct link

Domain: leetcodejavascript.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/array-transformation","name":"#1243 - Array Transformation - LeetCode JavaScript Solutions","description":"Given an initial array arr, every day you produce a new array using the array of the previous day. On the i-th day, you do the following ope...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * @param {number[]} arr\n * @return {number[]}\n */\nvar transformArray = function(arr) {\n  let current = [...arr];\n\n  while (true) {\n    const next = [...current];\n    let changed = false;\n\n    for (let i = 1; i < current.length - 1; i++) {\n      if (current[i] < current[i - 1] && current[i] < current[i + 1]) {\n        next[i]++;\n        changed = true;\n      } else if (current[i] > current[i - 1] && current[i] > current[i + 1]) {\n        next[i]--;\n        changed = true;\n      }\n    }\n\n    if (!changed) break;\n    current = next;\n  }\n\n  return current;\n};","keywords":"LeetCode 1243, #1243 - Array Transformation, Easy, JavaScript solution","learningResourceType":"Code","isAccessibleForFree":true,"educationalLevel":"intermediate","interactivityType":"mixed"}

authorLeetCodeJavascript.com
og:typearticle
og:imagehttps://leetcodejavascript.com/og-image.jpg
og:site_nameLeetCode JavaScript Solutions
twitter:cardsummary_large_image
twitter:urlhttps://leetcodejavascript.com/solutions/array-transformation
twitter:imagehttps://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/array-transformation/
View on GitHub https://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/1243-array-transformation.js
Array https://leetcodejavascript.com/tags/array
Simulation https://leetcodejavascript.com/tags/simulation
Josh Crozierhttps://joshcrozier.com

Viewport: width=device-width, initial-scale=1.0

Robots: index, follow


URLs of crawlers that visited me.