五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Leetcode 1502. Can Make Arithmetic Progression From Sequence

2023-03-11 14:56 作者:您是打尖兒還是住店呢  | 我要投稿

A sequence of numbers is called an?arithmetic progression?if the difference between any two consecutive elements is the same.

Given an array of numbers?arr, return?true?if the array can be rearranged to form an?arithmetic progression. Otherwise, return?false.

?

Example 1:

Input: arr = [3,5,1]

Output: trueExplanation: We can reorder the elements as [1,3,5] or [5,3,1] with differences 2 and -2 respectively, between each consecutive elements.

Example 2:

Input: arr = [1,2,4]

Output: falseExplanation: There is no way to reorder the elements to obtain an arithmetic progression.

?

Constraints:

  • 2 <= arr.length <= 1000

  • -106?<= arr[i] <= 106

就是之前在學校學習的等差數(shù)列。



Runtime:?1 ms, faster than?99.05%?of?Java?online submissions for?Can Make Arithmetic Progression From Sequence.

Memory Usage:?42.2 MB, less than?18.88%?of?Java?online submissions for?Can Make Arithmetic Progression From Sequence.


Leetcode 1502. Can Make Arithmetic Progression From Sequence的評論 (共 條)

分享到微博請遵守國家法律
县级市| 丰镇市| 涞源县| 赤城县| 西和县| 宁波市| 蒲城县| 牙克石市| 竹山县| 白水县| 广丰县| 梓潼县| 大厂| 朝阳县| 松溪县| 保山市| 印江| 昌平区| 苏尼特右旗| 芦溪县| 遂宁市| 广平县| 武川县| 蒙山县| 株洲县| 资中县| 陕西省| 静宁县| 聂拉木县| 施秉县| 德保县| 保康县| 渭源县| 岐山县| 九龙坡区| 辰溪县| 莱州市| 武强县| 施秉县| 天峨县| 赤壁市|