René's URL Explorer Experiment


Title: #41 - First Missing Positive - LeetCode JavaScript Solutions

Open Graph Title: #41 - First Missing Positive - LeetCode JavaScript Solutions

X Title: #41 - First Missing Positive - LeetCode JavaScript Solutions

Description: Given an unsorted integer array nums, return the smallest missing positive integer. You must implement an algorithm that runs in O(n) time a...

Open Graph Description: Given an unsorted integer array nums, return the smallest missing positive integer. You must implement an algorithm that runs in O(n) time a...

X Description: Given an unsorted integer array nums, return the smallest missing positive integer. You must implement an algorithm that runs in O(n) time a...

Keywords:

Opengraph URL: https://leetcodejavascript.com/solutions/first-missing-positive

direct link

Domain: leetcodejavascript.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/first-missing-positive","name":"#41 - First Missing Positive - LeetCode JavaScript Solutions","description":"Given an unsorted integer array nums, return the smallest missing positive integer. You must implement an algorithm that runs in O(n) time a...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * @param {number[]} nums\n * @return {number}\n */\nvar firstMissingPositive = function(nums) {\n  let i = 0;\n\n  while (i < nums.length) {\n    if (nums[i] > 0 && nums[i] <= nums.length && nums[nums[i] - 1] !== nums[i]) {\n      [nums[nums[i] - 1], nums[i]] = [nums[i], nums[nums[i] - 1]];\n    } else {\n      i++;\n    }\n  }\n\n  for (i = 0; i < nums.length; i++) {\n    if (nums[i] !== i + 1) {\n      return i + 1;\n    }\n  }\n\n  return i + 1;\n};","keywords":"LeetCode 41, #41 - First Missing Positive, Hard, 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/first-missing-positive
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/first-missing-positive/
View on GitHub https://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/0041-first-missing-positive.js
Array https://leetcodejavascript.com/tags/array
Hash Table https://leetcodejavascript.com/tags/hash-table
Josh Crozierhttps://joshcrozier.com

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

Robots: index, follow


URLs of crawlers that visited me.