1672 Commits

Author SHA1 Message Date
ff606a019e chore: improve the Gitpod file (#1203)
* chore: improve the Gitpod file

* Updated Documentation in README.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-10-17 16:56:18 -05:00
8b5d006c9b chore: update Discord invite link (#1202) 2022-10-17 19:26:25 +02:00
e65211299b feature: add fast fibonacci algorithm (#1155) 2022-10-17 01:54:44 +05:30
829d3fd807 solution: Project Euler Problem 28 (#1198) 2022-10-17 01:54:11 +05:30
2a62eabfd7 tests: Project Euler Problem 2 (#1200) 2022-10-17 01:52:29 +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
18baef8e7e feat: insertion sort with binary search (#1182) 2022-10-16 10:47:18 +02:00
8c847e3aea solution: Project Euler Problem 13 (#1173)
* Included Project Euler 13 solution

* Fix review comments

* Fix style

* fix for code review

* fix the review

* Fix Style

Co-authored-by: Matheus Muriel <Matheus_MurielFerreira@swissre.com>
2022-10-15 15:01:02 +05:30
4df1e9e90e tests: Project Euler Problem 1 (#1161)
* 📦 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

Co-authored-by: Omkarnath Parida <omkarnath.parida@yocket.in>
2022-10-15 14:58:06 +05:30
36c6a4d29b solution: Project Euler Problem 11 (#1172)
* Included Project Euler 11 solution

* Fix review comments

Co-authored-by: Matheus Muriel <Matheus_MurielFerreira@swissre.com>
2022-10-15 14:56:15 +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
148ebd6625 algorithm: Project Euler Problem 44 (#1188)
* [CREATE] Problem 044 from Project Euler

* [UPDATE] Code styling update

* [UPDATE] Change return condition, added an input for main function,
added tests for problem 44

* [UPDATE] minor styling fixes to standard javascript

* [UPDATE] Fix parentheses in main function return
2022-10-15 14:38:48 +05:30
bd7de6a010 chore: Remove unused deps, clean up package.json a bit (#1176) 2022-10-13 17:27:05 +02:00
32b9a9900e Swapsort algorithm and corresponding tests (#1152) 2022-10-13 17:26:31 +05:30
10079a7b70 Renamed NQueen file, variables to NQueens, raised RangeError exception (#1162) 2022-10-13 17:22:59 +05:30
5a6b1d0d9e feat: Project Euler Problem 17 (#1168) 2022-10-13 10:42:56 +02:00
564ee8527a Add an algorithm to find mean absolute deviation (#1165) 2022-10-12 10:26:09 +05:30
514c7c4c9f feat: added Project Euler Problem 13 (#1150) 2022-10-12 10:24:09 +05:30
d94929ea0d fix: DateToDay (#1125) 2022-10-10 11:31:58 +05:30
e32fdce52f Rename palindrome test to Palindrome to follow standard (#1159) 2022-10-10 11:29:26 +05:30
ede60b81d9 algorithm: catalan numbers (#1149) 2022-10-09 17:45:26 +05:30
78f023fdd1 algorithm: Log2 using bitwise operations (#1132) 2022-10-09 17:36:23 +05:30
56713e8f43 Upgrade actions in Ci.yml workflow (#1153) 2022-10-09 17:35:06 +05:30
907b86c343 Rename to CaesarCipher (#1144) 2022-10-08 19:47:04 +05:30
d0e61e1f69 solution: ProjectEuler-007 (#1142)
* 📦 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

Co-authored-by: Omkarnath Parida <omkarnath.parida@yocket.in>
2022-10-08 12:27:02 +05:30
109e4a685b algorithm: find length of an arc and area of the sector formed by an arc of a circle (#1119)
* Add an algorithm to find length and area of an arc of a circle

* Updated to follow Javascript Standard Style

* Update CircularArc.js

* Update CircularArc.js

* Add tests

* Followed Javascript standard style
2022-10-08 12:26:06 +05:30
8461271fc8 added check for Integer (#1137) 2022-10-07 17:16:28 +05:30
b71815d50c Fix grammar mistakes in JSDoc (#1127) 2022-10-07 10:51:54 +05:30
9a3d64c91f chore: add instruction for installing dependencies (#1120) 2022-10-07 10:50:52 +05:30
23adfc76d9 algorithm: Minesweeper (#1129) 2022-10-07 10:45:25 +05:30
c365e82d08 Adding testcases for Boyer Moore Algorithm (#1135) 2022-10-07 10:44:11 +05:30
ea7d06ad57 tests: Levenshtein Distance (dynamic programming solution) (#1114) 2022-10-06 00:38:23 +05:30
9528c71107 Added testcases for Zero One Knapsack (#1109) 2022-10-02 11:19:31 +05:30
7a1141b637 refactor: BFS tree algorithms (#1108)
* Bugfix AVLTree comparator

The original insertBalance function was doing raw value comparisons as opposed to using the tree's comparator. This is clearly unintentional, and would (ultimately) cause the structure to segfault when constructed with the stringData included in the updated test.

I've added the fix, scanned the rest of the code for similar issues, and added the appropriate test case which passes successfully with the fix. The jest code coverage increases slightly as well with the changes.

* 100% jest code coverage

Added a couple of extra elements to the original test tree, and then removed elements in an order such that all previously uncovered branches of code are now covered.

Also added an emptyTree structure to test some additional (trivial) base cases.

* standard style fix

missed this from my previous commit

* Iterative & in-place BFS

An iterative analog to the traditional recursive breadth-first-search algorithm for binary trees.

This in-place solution uses the pre-existing "traversal" array for both tracking the algorithm as well as storing the result.

Also tweaked old code by resetting the traversal array each time the tree is traversed (otherwise you're only allowed to traverse a tree once which doesn't seem correct even with a single traversal function).

* Update BreadthFirstTreeTraversal.js

got rid of unnecessary currentSize
added currentNode for clarity

* refactor out traversal member var

.. per earlier discussion w mods
also tweaked the tests to achieve 100% coverage
2022-09-25 13:41:00 +05:30
7ab9792f16 algorithm: Iterative (and in-place) BFS for binary trees (#1102)
* Bugfix AVLTree comparator

The original insertBalance function was doing raw value comparisons as opposed to using the tree's comparator. This is clearly unintentional, and would (ultimately) cause the structure to segfault when constructed with the stringData included in the updated test.

I've added the fix, scanned the rest of the code for similar issues, and added the appropriate test case which passes successfully with the fix. The jest code coverage increases slightly as well with the changes.

* 100% jest code coverage

Added a couple of extra elements to the original test tree, and then removed elements in an order such that all previously uncovered branches of code are now covered.

Also added an emptyTree structure to test some additional (trivial) base cases.

* standard style fix

missed this from my previous commit

* Iterative & in-place BFS

An iterative analog to the traditional recursive breadth-first-search algorithm for binary trees.

This in-place solution uses the pre-existing "traversal" array for both tracking the algorithm as well as storing the result.

Also tweaked old code by resetting the traversal array each time the tree is traversed (otherwise you're only allowed to traverse a tree once which doesn't seem correct even with a single traversal function).

* Update BreadthFirstTreeTraversal.js

got rid of unnecessary currentSize
added currentNode for clarity
2022-09-22 17:24:29 +05:30
9bcf16ba4b refactor: RotateListRight.js and added tests (#1101)
* Refactored RotatedListRight.js and added its tests

* rotateListRight test and improved implementation

* Review changes on constructor's loop
2022-09-22 17:22:11 +05:30
d05bbf77c6 algorithm: first unique char in a string (#1103)
* feat: Added Algo first unique char in a string.

* Optimised algo to linear time complexity

* removed double quotes

* Review changes: if-else logic
2022-09-22 17:20:04 +05:30
c7f9bf961c algorithm: Square free integer (#1104)
* feat: Add square free integer implementation

* test: Add unit tests for square free integer

* refactor: Remove trailing whitespace from line 27

* refactor: Fix comments
2022-09-22 17:18:36 +05:30
cf0593f430 Refactor Cycledetection.js and added it's test. (#1099) 2022-09-15 12:22:44 +05:30
d1152144aa algorithm: Liouville function (#1100) 2022-09-15 12:20:58 +05:30
e7ee09a07d feat: AVLTree 100% test coverage (#1098) 2022-09-13 14:45:20 +05:30
6ad2467545 algorithm: find the middle of linked-list (#1096)
* Added Middle of linked-list implementation.

* Added Middle of LL function and tests

* Refactor: Added method in singly LL and its tests

* Refactor: Method name and inline test calls

* Use `!== null` instead of `!= null`

Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2022-09-10 19:17:50 +05:30
644d7f7faa Binomial coefficient implementation (#1094) 2022-09-08 10:14:33 +05:30
6c718c01d4 add: countSubstrings function implementation (#1091) 2022-09-07 15:03:24 +05:30
61c9e8b372 fix: factorial function (#1093) 2022-09-07 15:00:35 +05:30
6f55ed4a1f algorithm: mobius function implementation (#1088)
* feat: Add mobius function implementation

* test: Add tests for mobius function

* fix: Code style fixes

* fix: Code style fixes

* fix: Store prime factors in a variable &  add throw error

* fix: Fix unit tests for zero and negative numbers

* fix: Minor code style fixes
2022-09-06 15:25:28 +05:30
ad41e8cc1c fix: spellings which are making ci fail (#1089)
* Updated Documentation in README.md

* chore: remove wrong spelling

* ci: recognize "falsy" as correct spelling

* chore: fix spelling

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2022-09-05 11:06:24 +05:30
a133529122 merge: Bugfix AVLTree comparator (#1084)
The original insertBalance function was doing raw value comparisons as opposed to using the tree's comparator. This is clearly unintentional, and would (ultimately) cause the structure to segfault when constructed with the stringData included in the updated test.

I've added the fix, scanned the rest of the code for similar issues, and added the appropriate test case which passes successfully with the fix. The jest code coverage increases slightly as well with the changes.
2022-08-15 21:57:31 +05:30
979046897d merge: Edit Perfect{Square, Cube} (#1071)
* Make `PerfectCube` more correct and readable

* Add negative and Infinity tests

* Fixed comment formatting

* Realized BigInt support is unnecessary

The algorithm would be exactly the same, so there's no added educational value

* Update PerfectCube.js

* Remove space

* Update PerfectCube.js

Now `isInt` is replaced by `isFinite`, because `isInt` is a redundant check

* Update PerfectCube.js

Remove dot

* Parity between `PerfectSquare` and `PerfectCube`

* Update PerfectSquare.test.js

Fixed the old copy-paste error that said "cube" instead of "square". And added `Infinity` test
2022-08-12 23:14:25 +05:30