We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 53e3938 commit 96224e7Copy full SHA for 96224e7
Bit-Manipulation/BinaryCountSetBits.js
@@ -16,7 +16,7 @@ function BinaryCountSetBits(a) {
16
17
let count = 0
18
while (a) {
19
- a &= (a - 1)
+ a &= a - 1
20
count++
21
}
22
Maths/AutomorphicNumber.js
@@ -35,6 +35,6 @@ export const isAutomorphic = (n) => {
35
n = Math.floor(n / 10)
36
n_sq = Math.floor(n_sq / 10)
37
38
-
+
39
return true
40
Maths/test/AutomorphicNumber.test.js
@@ -9,19 +9,19 @@ describe('AutomorphicNumber', () => {
9
})
10
11
test.each([
12
- { n: -3 , expected: false },
13
- { n: -25 , expected: false },
+ { n: -3, expected: false },
+ { n: -25, expected: false }
14
])('should return false when n is negetive', ({ n, expected }) => {
15
expect(isAutomorphic(n)).toBe(false)
- { n: 7 , expected: false },
- { n: 83 , expected: false },
- { n: 0 , expected: true },
- { n: 1 , expected: true },
23
- { n: 376 , expected: true },
24
- { n: 90625 , expected: true },
+ { n: 7, expected: false },
+ { n: 83, expected: false },
+ { n: 0, expected: true },
+ { n: 1, expected: true },
+ { n: 376, expected: true },
+ { n: 90625, expected: true }
25
])('should return $expected when n is $n', ({ n, expected }) => {
26
expect(isAutomorphic(n)).toBe(expected)
27
Project-Euler/Problem006.js
@@ -1,8 +1,8 @@
1
// https://projecteuler.net/problem=6
2
3
export const squareDifference = (num = 100) => {
4
- let sumOfSquares = (num)*(num+1)*(2*num+1)/6
5
- let sums = (num*(num+1))/2
6
+ let sumOfSquares = (num * (num + 1) * (2 * num + 1)) / 6
+ let sums = (num * (num + 1)) / 2
7
return sums ** 2 - sumOfSquares // difference of square of the total sum and sum of squares
8
Recursive/test/BinaryEquivalent.test.js
@@ -1,29 +1,29 @@
-import { binaryEquivalent } from "../BinaryEquivalent";
+import { binaryEquivalent } from '../BinaryEquivalent'
const tests = [
- {
- test: 2,
- expectedValue: "10"
- },
- test: 0,
- expectedValue: "0"
- test: 543,
- expectedValue: "1000011111"
- test: 4697621023,
- expectedValue: "100011000000000000000001000011111"
- }
+ {
+ test: 2,
+ expectedValue: '10'
+ },
+ test: 0,
+ expectedValue: '0'
+ test: 543,
+ expectedValue: '1000011111'
+ test: 4697621023,
+ expectedValue: '100011000000000000000001000011111'
+ }
]
-describe("Binary Equivalent", () => {
- test.each(tests)(
- "of $test should be $expectedValue",
- ({test, expectedValue}) => {
- expect(binaryEquivalent(test)).toBe(expectedValue);
28
- )
+describe('Binary Equivalent', () => {
+ test.each(tests)(
+ 'of $test should be $expectedValue',
+ ({ test, expectedValue }) => {
+ expect(binaryEquivalent(test)).toBe(expectedValue)
+ )
29
Search/InterpolationSearch.js
@@ -36,4 +36,4 @@ export function interpolationSearch(arr, key) {
return -1
-}
+}
0 commit comments