259 Commits

Author SHA1 Message Date
a62a46e732 Resolve duplicate entries for sieve of eratosthenes (#1770)
* remove intarr test

* Remove main file oops

* FIXES: #1666 , remove references to SieveOfEratosthenesIntArray

* Finally fix the requirements, passes vitest

* Updated Documentation in README.md

* FIXES: #1666 and conform to alg comment standards

---------

Co-authored-by: SpiderMath <SpiderMath@users.noreply.github.com>
2025-01-12 15:57:54 +05:30
55ff0ade85 docs: fixed misleading comment about the array method (forEach instead of reduce) used in AverageMean.js (#1727)
* docs: fixed misleading comment about the array method (forEach instead of reduce) used in AverageMean.js

* fix: optimized AverageMean.js by removing redundant comments and unnecessary operations.

* Update Maths/AverageMean.js

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>

---------

Co-authored-by: Hridyanshu7 <himank7794@gmail.com>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2024-10-16 23:52:31 +05:30
79b93d35b6 style: remove redundant eslint suppressions (#1667) 2024-06-12 01:40:48 +05:30
34a663aca7 fix: hadnle zeros at the endpoints in BisectionMethod (#1640)
* fix: hadnle zeros at the endpoints

* style: use simpler syntax express polynomials

Co-authored-by: appgurueu <34514239+appgurueu@users.noreply.github.com>

---------

Co-authored-by: appgurueu <34514239+appgurueu@users.noreply.github.com>
2024-04-03 20:48:45 +05:30
702840b4c8 style: improve test names of GetEuclidGCD' (#1646) 2024-03-28 16:42:40 +05:30
bd34e9fa61 feat: remove duplicated gcd-like functions (#1642)
* feat: remove duplicated `gcd`-like functions

* Updated Documentation in README.md

---------

Co-authored-by: vil02 <vil02@users.noreply.github.com>
2024-03-16 09:29:14 +05:30
0204198465 feat: remove twinPrime (#1641)
* tests: add missing test of `twinPrime`

* feat: remove `twinPrime`
2024-03-12 01:56:29 +05:30
83b4dd8290 fix: cleanup CheckKishnamurthyNumber (#1626) 2024-03-02 13:25:14 +05:30
8734dfccf9 fix: handle zeros in CoPrimeCheck (#1622) 2024-02-29 10:36:08 +05:30
c067a34fae fix: GetEuclidGCD(0, 0) is 0 (#1621) 2024-02-28 11:47:22 +05:30
0e0cf98ce7 fix: cleanup CoPrimeCheck (#1609) 2024-02-27 14:24:29 +05:30
fb0a99c15a fix: throw error and add tests for ReverseNumber (#1608) 2024-02-19 19:26:54 +05:30
1ea7a5cd5e test: add missing test for SumOfGeometricProgression (#1607) 2024-02-14 21:13:38 +05:30
10febce31a style: cleanup PascalTriangle (#1606)
* tests: add missing tests for `PascalTriangle`

* style: remove redundant branch in `generate`

* tests: simplify tests of `PascalTriangle`
2024-02-09 22:31:20 +05:30
9a875264cc prettier fixes & added test cases for Project Euler problem 4 (#1566)
* 📦 NEW: Added solution for ProjectEuler-007

* 🐛 FIX: Spelling mistake fixes

* 👌 IMPROVE: changed variable name from `inc` to `candidateValue` and thrown error in case of invalid input

* 👌 IMPROVE: Modified the code

* 👌 IMPROVE: Added test case for ProjectEuler Problem001

* 👌 IMPROVE: Added test cases for Project Euler Problem 4

* 👌 IMPROVE: auto prettier fixes

---------

Co-authored-by: Omkarnath Parida <omkarnath.parida@yocket.in>
2023-10-24 19:19:37 +02:00
410009157d feat: add Automorphic Numbers and tests in Math (#1496)
* feat: add automorphic number and tests

* fix: add spaces

* fix: merge tests with test.each
2023-10-12 18:53:40 +00:00
05e32481fa chore: format code (#1515)
* chore: format code

* Updated Documentation in README.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-12 06:32:18 +00:00
3823eded0a feat: add row echelon matrix algorithm (#1454)
* feat: add row echelon matrix algorithm

* test: add self-tests for row echelon algorithm

* fix: replace rounding with float tolerance

* chore: use correct style

* fix: use error tolerance and segregate testcases

* chore: add necessary explaining comments
2023-10-11 06:04:33 +00:00
a24450a629 feat: add determinant algorithm (#1438)
* feat: add determinant calculating algorithm

* test: add self-tests for determinant algorithm

* chore: add wikipedia info link

* fix: change initialization to zero

* fix: add error throw and general code improvements

* fix: add error try and catch

* fix: seperate the test loops of error cases

* clean up a bit

---------

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2023-10-11 06:03:02 +00:00
13161bdadb feat: Combined Min Heap and Max Heap classes (#1494)
* Combined Min Heap and Max Heap classes

* Added JSdoc comments and also improved tests for binary heap

* Added private methods for BinaryHeap class

* JSDoc knows that a class is a class

I assume the @class tag is for classes implemented via constructor functions, not using ES6 class syntax

---------

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2023-10-10 12:44:34 +05:30
c5a25665e0 bug: abs returns 0 on an empty array (#1473)
* bug: update edge case for empty array

* bug: add edge case for empty arrays

* feat: add test case for empty array

---------

Co-authored-by: Ridge Kimani <ridgekimani@gmail.com>
2023-10-10 12:34:09 +05:30
342382932d feat: Added Euclidean Distance (#1418)
* Added Euclidean Distance

* Added documentation to params

* Use @see annotation

---------

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2023-10-05 15:31:48 +05:30
1de5ab7d71 Feat: TwoSum function created with test cases (#1399)
* fix: #758  optimised armstrongNumber code

* fix:#758 Average Median code optimised

* feat: TwoSum function added with test cases

* revert code

* Fix: #758 used ternary operator to make code more optimised

* Feat: TwoSum function created with test cases

* Feat: TwoSum function created with test cases

* Resolved comments and changes requests
2023-10-04 09:59:01 +05:30
86d333ee94 feat: Test running overhaul, switch to Prettier & reformat everything (#1407)
* chore: Switch to Node 20 + Vitest

* chore: migrate to vitest mock functions

* chore: code style (switch to prettier)

* test: re-enable long-running test

Seems the switch to Node 20 and Vitest has vastly improved the code's and / or the test's runtime!

see #1193

* chore: code style

* chore: fix failing tests

* Updated Documentation in README.md

* Update contribution guidelines to state usage of Prettier

* fix: set prettier printWidth back to 80

* chore: apply updated code style automatically

* fix: set prettier line endings to lf again

* chore: apply updated code style automatically

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2023-10-04 02:38:19 +05:30
b7836122ff fix: ValidateURL failing tests (#1394)
* test: remove ValidateUrl.test.js

The code was removed with ecac786d but the test was left here (and has been failing since then, obviously 🤣)

* test: remove conflicting test case

There is another test case that explicitly expects the `null` result when the input array only contains one element.

* Updated Documentation in README.md

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-10-02 12:43:37 +05:30
f271a2cae0 Added QuadraticRoots to Math/QuadraticRoots.js (#1376)
* Added QuadraticRoots in the Math/QuadraticRoots

* Fixed math/QyadraticRoots var to let

* Added relevant links math/QyadraticRoots

* Added relevant links math/QyadraticRoots and fixed let - const

* Added the changes and @see notation in Math/QuadraticRoots.js

* Added the changes Math/QuadraticRoots.js and return an empty []

* Readd describe block, remove redundant comments

* Changed [1,1] to [1]

---------

Co-authored-by: Dibya <Dibya.DebayanDash@siriuscom.com>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2023-10-02 12:42:39 +05:30
0604d06ac6 fix: Average Median code cleanup (#1388) 2023-10-02 12:34:43 +05:30
964ba049d7 fix: optimised armstrongNumber code (#1374) 2023-09-30 17:35:27 +05:30
6362cc967a added an algo for checking the string i palindrome or not (#1366)
Co-authored-by: madhuredra <madhuredra.tiwari@zemosolabs.com>
2023-09-23 21:30:10 +05:30
6ad5b9c2b1 added numberOfDigitsUsingLog method (#1364)
* added numberOfDigitsUsingLog method

* added JSDoc comment

---------

Co-authored-by: madhuredra <madhuredra.tiwari@zemosolabs.com>
2023-09-22 13:49:13 +05:30
268796b0e8 added fibonacci using formula along with test cases (#1358)
* added fibonacci using formula along with test cases

* updated the changes

* added jest's each in test cases

* added jest's each for testing

* returned inline value

* removed redundant comment

* hoisted the variables

* Use shorthand

* considered adding resource of the formula

---------

Co-authored-by: madhuredra <madhuredra.tiwari@zemosolabs.com>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2023-09-19 20:29:34 +05:30
00e40e6f06 Fix/code smells (#1338)
* ♻️ refactor: improving and fixing some code

* Updated Documentation in README.md

* ♻️ refactor: improving isLeapYear

* 🐛 chore: back changes

* 🐛 fix: using reduce instead forEach

* 🐛 fix: using reduce instead forEach

* 🐛 fix: removing duplicated code

* 🐛 chore: removing .js

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2023-08-21 23:36:43 +05:30
9b32db29d8 Update: Added Unary Operator in SumOfDigits algorithm (#1348)
* Update: Added Unary Operator in SumOfDigits algorithm

* Update: Added Unary Operator in SumOfDigits algorithm
2023-08-15 01:24:00 +05:30
e6df6ebad6 New Algorithm: Parity Outlier (#1314)
* [feat] New algorithm

* [test] Add new test for ParityOutlier.js

* [fix] Reset indentation

* [fix] Reset indentation

* [fix] Style changes

* fix: improve code efficiency and a glitch

* test: adds a new possible test case

* fix: style fix

* fix: delete redundant comments and else statements

* [fix] style fix
2023-05-01 11:46:48 +05:30
002b10a5aa docs: fix typos (#1283)
* docs: fix typos

* fix
2023-02-07 22:20:28 +05:30
65cceae0be algorithm: signum (#1266) 2022-12-08 18:57:42 +05:30
18a91573c3 Added a new Maths algorithm to determine if two non-null integers are "friendly numbers" (#1267) 2022-11-30 16:51:08 +05:30
d6be3a4e96 algorithm: Hexagonal number (#1265) 2022-11-30 16:50:38 +05:30
640abcf468 fix: exchanging wrong path that breaks pipeline (#1262) 2022-11-02 13:54:05 +01:00
c39d6665ce algorithm: logarithmic square root (#1259)
* algorithm: add SquareRootLogarithmic algo and a test for it

* fix: fix spelling errors

* refactor: rename a variable "e" --> "edge"
2022-10-31 22:20:33 +05:30
35e1fe68d0 algorithm: add IntToBase algo and a test for it (#1258) 2022-10-31 22:19:14 +05:30
72ee63ca0f fix: build error due to FindLcm (#1223)
Co-authored-by: patrickwestervelt <pwestervelt3@gatech.edu>
2022-10-24 17:24:45 +05:30
8c27d86afc enhancement: FindLCM algorithm (#1222)
Co-authored-by: patrickwestervelt <pwestervelt3@gatech.edu>
2022-10-23 12:49:19 +05:30
6f9a8e4b5a added-ModularArithmetic-code (#1217)
* added-ModularArithmetic-code

* fix-typo

* suggested changes
2022-10-20 20:33:06 +05:30
73bf91d7e1 Add an algorithm to find Taylor series approximation of exponential f… (#1160) 2022-10-20 17:10:22 +05:30
0084acf2d4 algorithm: sieve (#1205) 2022-10-20 16:50:37 +05:30
4ce3dbe6b4 dependencies: update and clean (and auto-fix style issues) (#1195)
* Update npm dependencies (and auto-fix style issues)

* Updated Documentation in README.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-16 16:09:56 +05:30
0df72642a5 algorithm: count the numbers divisible by ‘M’ in a given range (#1185)
*  test cases added for count divisible

*  count divisible math algorithm added

* style fixes
2022-10-15 14:52:44 +05:30
45f0b7cae6 algorithm: check if integer is palindrome (#1177)
* feat: Add check number case

* style: Fix formatting

* fix: Remove number check part

* feat: Create isPalindromeIntegerNumber

* test: Add minus number case
2022-10-15 14:44:44 +05:30
564ee8527a Add an algorithm to find mean absolute deviation (#1165) 2022-10-12 10:26:09 +05:30