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

Project Euler 15#1720

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

Open
pomkarnath98 wants to merge21 commits intoTheAlgorithms:master
base:master
Choose a base branch
Loading
frompomkarnath98:project-euler-15
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
21 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
718d515
Merge branch 'TheAlgorithms:master' into master
pomkarnath98Sep 28, 2024
396782d
Merge branch 'TheAlgorithms:master' into master
pomkarnath98Oct 5, 2024
944077b
Merge branch 'TheAlgorithms:master' into master
pomkarnath98Oct 8, 2024
096e624
📦 NEW: Added test cases for Project Euler Problem 15 and a minor bug …
omkarnathparidaOct 8, 2024
716c7d1
Updated Documentation in README.md
pomkarnath98Oct 8, 2024
2e34e5d
📦 NEW: added a new case for Project Euler Problem 15
omkarnathparidaOct 8, 2024
737fc6c
Merge branch 'project-euler-15' of https://github.com/pomkarnath98/Ja…
omkarnathparidaOct 8, 2024
601dd43
🐛 FIX: Project Euler - 15 | fixed spelling error
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
4 changes: 2 additions & 2 deletionsProject-Euler/Problem015.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,8 +7,8 @@ How many such routes are there through a 20×20 grid?
// A lattice path is composed of horizontal and vertical lines that pass through lattice points.

export const latticePath = (gridSize) => {
let paths
for (let i = 1, paths = 1; i <= gridSize; i++) {
let paths = 1
for (let i = 1; i <= gridSize; i++) {
paths = (paths * (gridSize + i)) / i
}
// The total number of paths can be found using the binomial coefficient (b+a)/a.
Expand Down
14 changes: 14 additions & 0 deletionsProject-Euler/test/Problem015.test.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
import { expect } from 'vitest'
import { latticePath } from '../Problem015'

describe('Finding total numbers of Lattice Paths', () => {
test.each([
[2, 6],
[4, 70],
[5, 252],
[10, 184756],
[20, 137846528820]
])('If Grid Size: %i, then Lattice Paths count: %i', (a, expected) => {
expect(latticePath(a)).toBe(expected)
})
})

[8]ページ先頭

©2009-2025 Movatter.jp