This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// shorten constant to fit maximum length accepted by sentry | |
const shortenConstant = (constantCaseString, maxlength = 25, separator = '_') => { | |
// no need to shorten | |
if (!constantCaseString || constantCaseString.length < maxlength) { | |
return constantCaseString; | |
} | |
// abbreviate each word to fit the max length | |
const splittedConstantCaseTokens = constantCaseString.split(separator); | |
if (splittedConstantCaseTokens.length > 1) { |
Given a number of people N and an array of integers, each one representing the amount of people a type of umbrella can handle, output the minimum number of umbrellas needed to handle N people.
No umbrella could have left spaces. Which means if a umbrella can handle 2 people, there should be 2 people under it.
If there's no solution, return -1
.