Ticket numbers usually consist of an even number of digits. A ticket number is considered lucky if the sum of the first half of the digits is equal to the sum of the second half.
Given a ticket number n, determine if it's lucky or not.
Example
- For
n = 1230, the output should beisLucky(n) = true; - For
n = 239017, the output should beisLucky(n) = false.
Code
function isLucky(n) {
}
'알고리즘(CF)' 카테고리의 다른 글
| 13. reverseParentheses (1) | 2017.06.17 |
|---|---|
| 12. sortByHeight (1) | 2017.06.08 |
| 10. commonCharacterCount (1) | 2017.06.08 |
| 9. allLongestStrings (1) | 2017.06.08 |
| 8. matrixElementsSum (1) | 2017.06.08 |