Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add tests for Project Euler Problem 5 + minor refactor#1691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
appgurueu merged 23 commits intoTheAlgorithms:masterfrompomkarnath98:project-euler-5
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
23 commits
Select commitHold shift + click to select a range
b7309f0
📦 NEW: Added solution for ProjectEuler-007
omkarnathparidaOct 7, 2022
d3a3b33
🐛 FIX: Spelling mistake fixes
omkarnathparidaOct 7, 2022
e9b5a6a
👌 IMPROVE: changed variable name from `inc` to `candidateValue` and t…
omkarnathparidaOct 7, 2022
e99c722
👌 IMPROVE: Modified the code
omkarnathparidaOct 7, 2022
5ac898f
Merge branch 'TheAlgorithms:master' into master
pomkarnath98Oct 10, 2022
0f9f1ba
👌 IMPROVE: Added test case for ProjectEuler Problem001
omkarnathparidaOct 10, 2022
3caad5c
Merge branch 'TheAlgorithms:master' into master
pomkarnath98Oct 15, 2022
b7584fd
Merge branch 'TheAlgorithms:master' into master
pomkarnath98Oct 16, 2022
6693f9c
Merge branch 'TheAlgorithms:master' into master
pomkarnath98Oct 17, 2022
0830570
Merge branch 'TheAlgorithms:master' into master
pomkarnath98Oct 18, 2022
4d7149c
Merge branch 'TheAlgorithms:master' into master
pomkarnath98Oct 22, 2023
53e3938
👌 IMPROVE: Added test cases for Project Euler Problem 4
omkarnathparidaOct 22, 2023
96224e7
👌 IMPROVE: auto prettier fixes
omkarnathparidaOct 22, 2023
2863fa1
📦 NEW: Project Euler Problem 5 improvement and added test cases
omkarnathparidaSep 28, 2024
718d515
Merge branch 'TheAlgorithms:master' into master
pomkarnath98Sep 28, 2024
31329fc
Merge branch 'master' into project-euler-5
omkarnathparidaSep 28, 2024
96735d2
Updated Documentation in README.md
pomkarnath98Sep 28, 2024
b58c0a7
👌 IMPROVE: code improve
omkarnathparidaSep 28, 2024
f19f152
Merge branch 'project-euler-5' of https://github.com/pomkarnath98/Jav…
omkarnathparidaSep 28, 2024
5f7d046
🐛 FIX: remove extra code
omkarnathparidaOct 3, 2024
c0bf102
Merge branch 'TheAlgorithms:master' into project-euler-5
pomkarnath98Oct 5, 2024
a1117ef
👌 IMPROVE: test cases writing imrovements
omkarnathparidaOct 8, 2024
f3afdbb
Merge branch 'project-euler-5' of https://github.com/pomkarnath98/Jav…
omkarnathparidaOct 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletionsDIRECTORY.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,6 +35,8 @@
* [ROT13](Ciphers/ROT13.js)
* [VigenereCipher](Ciphers/VigenereCipher.js)
* [XORCipher](Ciphers/XORCipher.js)
* **Compression**
* [RLE](Compression/RLE.js)
* **Conversions**
* [ArbitraryBase](Conversions/ArbitraryBase.js)
* [ArrayBufferToBase64](Conversions/ArrayBufferToBase64.js)
Expand DownExpand Up@@ -285,6 +287,7 @@
* [Problem016](Project-Euler/Problem016.js)
* [Problem017](Project-Euler/Problem017.js)
* [Problem018](Project-Euler/Problem018.js)
* [Problem019](Project-Euler/Problem019.js)
* [Problem020](Project-Euler/Problem020.js)
* [Problem021](Project-Euler/Problem021.js)
* [Problem023](Project-Euler/Problem023.js)
Expand Down
8 changes: 3 additions & 5 deletionsProject-Euler/Problem005.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,11 +5,9 @@ Smallest multiple
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
*/

export const findSmallestMultiple = () => {
const divisors = [
20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2
]
let num = 21
export const findSmallestMultiple = (maxDivisor) => {
const divisors = Array.from({ length: maxDivisor }, (_, i) => i + 1)
let num = maxDivisor + 1
let result

while (!result) {
Expand Down
12 changes: 12 additions & 0 deletionsProject-Euler/test/Problem005.test.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
import { expect } from 'vitest'
import { findSmallestMultiple } from '../Problem005.js'

describe.concurrent('Find smallest multiple', () => {
test.each([
[10, 2520],
[15, 360360],
[20, 232792560]
])('max divisor -> %i, smallest multiple -> %i', (a, expected) => {
expect(findSmallestMultiple(a)).toBe(expected)
})
})

[8]ページ先頭

©2009-2025 Movatter.jp