Ad
  • Custom User Avatar
    describe("Solution", function() {
      it("should test for something", function() {
        var helper = new PaginationHelper(['a','b','c','d','e','f'], 4);
        assert.strictEqual(helper.pageItemCount(0), 4);
        assert.strictEqual(helper.pageItemCount(1), 2);
        assert.strictEqual(helper.pageItemCount(2), -1);
        
        var helper2 = new PaginationHelper(['a','b','c','d','e','f'], 2);
        assert.strictEqual(helper2.pageItemCount(-1), -1);
        assert.strictEqual(helper2.pageItemCount(0), 2);
        assert.strictEqual(helper2.pageItemCount(1), 2);
        assert.strictEqual(helper2.pageItemCount(2), 2);
        assert.strictEqual(helper2.pageItemCount(3), -1);
      });
    });
    

    They are passing, but the Attempt is not. I also think there is a problem.

  • Custom User Avatar

    Terribly indented code 🤮

  • Custom User Avatar

    you're overthinking this: this approach is actually very bad (think about its time complexity)

  • Custom User Avatar