Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit250b2e7

Browse files
authored
Fixed Formatting 1423-maximum-points-you-can-obtain-from-cards.js
1 parent233a3ab commit250b2e7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎javascript/1423-maximum-points-you-can-obtain-from-cards.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@
88
*/
99
varmaxScore=function(cardPoints,k){
1010

11-
consttotal=cardPoints.reduce((acc,curr)=>acc+curr,0);
12-
letcurrTotal=cardPoints.slice(0,cardPoints.length-k).reduce((acc,curr)=>acc+curr,0);
11+
consttotal=cardPoints.reduce((acc,curr)=>acc+curr,0);
12+
letcurrTotal=cardPoints.slice(0,cardPoints.length-k).reduce((acc,curr)=>acc+curr,0);
1313
letmax=total-currTotal;
1414

1515
letleft=0;
1616
letright=cardPoints.length-k-1;// -1 because the array is 0 indexed.
1717

18-
while(right<cardPoints.length){
18+
while(right<cardPoints.length){
1919
currTotal-=cardPoints[left];
2020
left++;
2121
right++;
22-
if(right<cardPoints.length){
22+
if(right<cardPoints.length){
2323
currTotal+=cardPoints[right];
2424
max=Math.max(max,total-currTotal);
2525
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp