Skip to content

Commit

Permalink
initial-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
clive-cudi committed Apr 2, 2023
1 parent fa75741 commit ccf63a2
Show file tree
Hide file tree
Showing 4,192 changed files with 1,204,995 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
23 changes: 23 additions & 0 deletions clive-cudi/count_zeros.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const { CountZeros: countZeros} = require("./count_zeros");

describe('countZeros', () => {
test('returns 0 when given an empty array', () => {
expect(countZeros([])).toBe(0);
});

test('returns 0 when given an array with no zeros', () => {
expect(countZeros([1, 2, 3])).toBe(0);
});

test('returns 1 when given an array with a single zero', () => {
expect(countZeros([0])).toBe(1);
});

test('returns the correct count when given an array with multiple zeros', () => {
expect(countZeros([1, 0, 5, 6, 0, 2])).toBe(2);
});

test('returns the correct count when given an array with all zeros', () => {
expect(countZeros([0, 0, 0, 0, 0])).toBe(5);
});
});
18 changes: 18 additions & 0 deletions clive-cudi/count_zeros.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Write a function CountZeros(A) that takes in an array of integers A, and returns the number of 0's in that array.
* For example, given [1, 0, 5, 6, 0, 2], the function/method should return 2.
*/

function CountZeros(A: number[]): number {
let count = 0;

for (let i = 0; i < A.length; i++) {
if (A[i] === 0) {
count++;
}
}

return count;
}

module.exports = {CountZeros};
5 changes: 5 additions & 0 deletions clive-cudi/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
1 change: 1 addition & 0 deletions clive-cudi/node_modules/.bin/browserslist

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clive-cudi/node_modules/.bin/browserslist-lint

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clive-cudi/node_modules/.bin/esparse

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clive-cudi/node_modules/.bin/esvalidate

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clive-cudi/node_modules/.bin/import-local-fixture

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clive-cudi/node_modules/.bin/jest

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clive-cudi/node_modules/.bin/js-yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clive-cudi/node_modules/.bin/jsesc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clive-cudi/node_modules/.bin/json5

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clive-cudi/node_modules/.bin/node-which

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clive-cudi/node_modules/.bin/parser

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clive-cudi/node_modules/.bin/resolve

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clive-cudi/node_modules/.bin/semver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clive-cudi/node_modules/.bin/ts-jest

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clive-cudi/node_modules/.bin/tsc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions clive-cudi/node_modules/.bin/tsserver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ccf63a2

Please sign in to comment.