[자바스크립트로 구현한 알고리즘] Return Negative
남양주개발자
·2016. 9. 17. 13:31
728x90
반응형
In this simple assignment you are given a number and have to make it negative. But maybe the number is already negative?
Example:
makeNegative(1); // return -1
makeNegative(-5); // return -5
makeNegative(0); // return 0
Notes:
The number can be negative already, in which case no change is required.
Zero (0) can't be negative, see examples above.
728x90
반응형
그리드형
'Computer science > 알고리즘' 카테고리의 다른 글
[자바스크립트로 구현한 알고리즘] Disemvowel Trolls (0) | 2016.09.17 |
---|---|
[자바스크립트로 구현한 알고리즘] Beginner Series #3 Sum of Numbers (0) | 2016.09.17 |
[자바스크립트로 구현한 알고리즘] Convert number to reversed array of digits (0) | 2016.09.14 |
[자바스크립트로 구현한 알고리즘] Sum of positive (0) | 2016.09.14 |
[자바스크립트로 구현한 알고리즘] Count by X (0) | 2016.09.12 |