UNPKG

dist-javascript-algorithms-and-data-structures

Version:

Algorithms and data-structures implemented on JavaScript

15 lines (13 loc) 289 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = switchSign; /** * Switch the sign of the number using "Twos Complement" approach. * @param {number} number * @return {number} */ function switchSign(number) { return ~number + 1; }