-
Description numMinusSeven(1000) --> 143 (arr.length)
Code function numMinusSeven(num) { let arr = [] while (num > 0) { num -= 7 arr.push(num) } return arr.length }
Test Cases const chai = require("chai"); const assert = chai.assert; chai.config.truncateThreshold = 0; const Test = require("@codewars/test-compat"); describe("Test", function() { it("should test for 1000", function() { Test.assertEquals(numMinusSeven(1000), 143); }); it("should test for 100", function() { Test.assertEquals(numMinusSeven(100), 15); }); it("should test for 10", function() { Test.assertEquals(numMinusSeven(10), 2); }); });
Output:
-
- All
- {{group.name}} ({{group.count}})
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}