René's URL Explorer Experiment


Title: #1370 - Increasing Decreasing String - LeetCode JavaScript Solutions

Open Graph Title: #1370 - Increasing Decreasing String - LeetCode JavaScript Solutions

X Title: #1370 - Increasing Decreasing String - LeetCode JavaScript Solutions

Description: You are given a string s. Reorder the string using the following algorithm: Remove the smallest character from s and append it to the resul...

Open Graph Description: You are given a string s. Reorder the string using the following algorithm: Remove the smallest character from s and append it to the resul...

X Description: You are given a string s. Reorder the string using the following algorithm: Remove the smallest character from s and append it to the resul...

Keywords:

Opengraph URL: https://leetcodejavascript.com/solutions/increasing-decreasing-string

direct link

Domain: leetcodejavascript.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/increasing-decreasing-string","name":"#1370 - Increasing Decreasing String - LeetCode JavaScript Solutions","description":"You are given a string s. Reorder the string using the following algorithm:  Remove the smallest character from s and append it to the resul...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * @param {string} s\n * @return {string}\n */\nvar sortString = function(s) {\n  const charCounts = new Array(26).fill(0);\n  for (const char of s) {\n    charCounts[char.charCodeAt(0) - 97]++;\n  }\n\n  let result = '';\n  while (result.length < s.length) {\n    for (let i = 0; i < 26; i++) {\n      if (charCounts[i] > 0) {\n        result += String.fromCharCode(i + 97);\n        charCounts[i]--;\n      }\n    }\n    for (let i = 25; i >= 0; i--) {\n      if (charCounts[i] > 0) {\n        result += String.fromCharCode(i + 97);\n        charCounts[i]--;\n      }\n    }\n  }\n\n  return result;\n};","keywords":"LeetCode 1370, #1370 - Increasing Decreasing String, 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/increasing-decreasing-string
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/increasing-decreasing-string/
View on GitHub https://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/1370-increasing-decreasing-string.js
String https://leetcodejavascript.com/tags/string
Hash Table https://leetcodejavascript.com/tags/hash-table
Counting https://leetcodejavascript.com/tags/counting
Josh Crozierhttps://joshcrozier.com

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

Robots: index, follow


URLs of crawlers that visited me.