added algo for checking the number is power of four or not (#1360)

* added algo for checking the number is power of four or not

* Update IsPowerofFour.js

* Update IsPowerofFour.js

* fix code style

* used proper JSDoc comment and fixed test issues

* fixed test case issue

---------

Co-authored-by: madhuredra <madhuredra.tiwari@zemosolabs.com>
This commit is contained in:
Madhurendra Nath Tiwari
2023-09-22 14:51:29 +05:30
committed by GitHub
parent 6ad5b9c2b1
commit 4fe8a67ea6
2 changed files with 31 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
import { isPowerOfFour } from '../IsPowerofFour'
describe('IsPowerOfFour', () => {
it.each([
[0, false],
[4, true],
[16, true],
[12, false],
[64, true],
[-64, false]
])('should return the number is power of four or not', (n, expected) => {
expect(isPowerOfFour(n)).toBe(expected)
})
})