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

Commit6794e9d

Browse files
Merge pull requestneetcode-gh#2815 from chetannada/ltc-2160-js
Create 2160-minimum-sum-of-four-digit-number-after-splitting-digits.js
2 parentsf3b2304 +b2975c9 commit6794e9d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
*@param {number} num
3+
*@return {number}
4+
*/
5+
varminimumSum=function(num){
6+
letstr=String(num).split("").sort();// intialize str and split the num using String(), split() and sort()
7+
returnparseInt(str[0]+str[2])+parseInt(str[1]+str[3]);// return sum of 1st, 3rd and 2nd, 4th string digit and convert into num using parseInt
8+
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp