Title: #539 - Minimum Time Difference - LeetCode JavaScript Solutions
Open Graph Title: #539 - Minimum Time Difference - LeetCode JavaScript Solutions
X Title: #539 - Minimum Time Difference - LeetCode JavaScript Solutions
Description: Given a list of 24-hour clock time points in "HH:MM" format, return the minimum minutes difference between any two time-points in ...
Open Graph Description: Given a list of 24-hour clock time points in "HH:MM" format, return the minimum minutes difference between any two time-points in ...
X Description: Given a list of 24-hour clock time points in "HH:MM" format, return the minimum minutes difference between any two time-points in ...
Keywords:
Opengraph URL: https://leetcodejavascript.com/solutions/minimum-time-difference
Domain: leetcodejavascript.com
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/minimum-time-difference","name":"#539 - Minimum Time Difference - LeetCode JavaScript Solutions","description":"Given a list of 24-hour clock time points in "HH:MM" format, return the minimum minutes difference between any two time-points in ...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * @param {string[]} timePoints\n * @return {number}\n */\nvar findMinDifference = function(timePoints) {\n const minutes = timePoints.map(time => {\n const [h, m] = time.split(':').map(Number);\n return h * 60 + m;\n }).sort((a, b) => a - b);\n let diff = Infinity;\n\n for (let i = 1; i < minutes.length; i++) {\n diff = Math.min(diff, minutes[i] - minutes[i - 1]);\n }\n\n return Math.min(diff, 1440 - minutes[minutes.length - 1] + minutes[0]);\n};","keywords":"LeetCode 539, #539 - Minimum Time Difference, Medium, 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/minimum-time-difference |
| 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/minimum-time-difference/ |
| View on GitHub | https://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/0539-minimum-time-difference.js |
| Array | https://leetcodejavascript.com/tags/array |
| String | https://leetcodejavascript.com/tags/string |
| Math | https://leetcodejavascript.com/tags/math |
| Sorting | https://leetcodejavascript.com/tags/sorting |
| Josh Crozier | https://joshcrozier.com |
Viewport: width=device-width, initial-scale=1.0
Robots: index, follow