Given an array with integers, remove numbers which are duplicated with previous or next sibling.
For example, with array [1, 3, 2, 2, 2, 4, 7, 7, 9, 5, 3], the result should be [1, 3, 4, 9, 5, 3].
function kumite(arr) {
return [];
}
const expect = require("chai").expect;
describe("Solution", function() {
// it("should get [1, 3, 4, 9, 5, 3] when given [1, 3, 2, 2, 2, 4, 7, 7, 9, 5, 3]", function() {
// const result = kumite([1, 3, 2, 2, 2, 4, 7, 7, 9, 5, 3]);
// expect(result).to.deep.equal([1, 3, 4, 9, 5, 3]);
// });
it("should get [] when given [1, 1, 2, 2, 2, 99, 99]", function() {
const result = kumite([1, 1, 2, 2, 2, 99, 99]);
expect(result).to.deep.equal([]);
});
});
Check given number, return true if it is an even number, otherwise return false.
For example isEven(3) will return false, isEven(4) will turn true.
function isEven(input) {
return true;
}
const expect = require("chai").expect;
describe("Solution", function() {
it("should be true for 4", function() {
expect(isEven(4)).to.equal(true);
});
});