export function reverseInt(n: number) { return parseInt(new String(n).split('').reverse().join('')) }
function reverseInt(n) {let reversed = 0;while(n >= 0){reversed = reversed * 10 + (n % 10);n /= 10;}return reversed;}- export function reverseInt(n: number) {
- return parseInt(new String(n).split('').reverse().join(''))
- }
// See https://www.chaijs.com for how to use Chai. import { assert } from "chai"; import { reverseInt } from "./solution"; // TODO Add your tests here describe("reverseInt", function() { it("test", function() { assert.strictEqual(reverseInt(103),301); }); });
import org.junit.Test;import static org.junit.Assert.assertEquals;import org.junit.runners.JUnit4;- // See https://www.chaijs.com for how to use Chai.
- import { assert } from "chai";
// TODO: Replace examples and use TDD development by writing your own tests- import { reverseInt } from "./solution";
public class SolutionTest {@Testpublic void reverseIntTest() {assertEquals(54321, Algorithms.reverseInt(12345));}}- // TODO Add your tests here
- describe("reverseInt", function() {
- it("test", function() {
- assert.strictEqual(reverseInt(103),301);
- });
- });