We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1502. 判断能否形成等差数列
/** * @param {number[]} arr * @return {boolean} */ var canMakeArithmeticProgression = function(arr) { arr.sort((a, b) => a-b); const bench = arr[1] - arr[0]; for(let i=1, len=arr.length; i<len; i++) { if(arr[i] - arr[i-1] != bench) { return false; } } return true; };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
1502. 判断能否形成等差数列
The text was updated successfully, but these errors were encountered: