Skip to content

Instantly share code, notes, and snippets.

@ximing
Created November 18, 2018 08:42
Show Gist options
  • Select an option

  • Save ximing/7333694b6cc2bb217d114e99a8bed14c to your computer and use it in GitHub Desktop.

Select an option

Save ximing/7333694b6cc2bb217d114e99a8bed14c to your computer and use it in GitHub Desktop.
codewars
~~count === count || 0
@ximing
Copy link
Copy Markdown
Author

ximing commented Nov 19, 2018

// 大数相加
function sumStrings(a, b) {
var res = '', c = 0;
a = a.split('');
b = b.split('');
while (a.length || b.length || c) {
c += ~~a.pop() + ~~b.pop();
res = c % 10 + res;
c = c > 9;
}
return res.replace(/^0+/, '');
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment