├── .gitattributes
├── .github
└── ISSUE_TEMPLATE
│ ├── hacktoberfest-template.md
│ └── proposed-challenge-template.md
├── .gitignore
├── .vscode
└── settings.json
├── CONTRIBUTING.md
├── LICENSE
├── PARTICIPANTS.md
├── README.md
├── REVIEWERS.md
├── SCHEDULE.md
├── challenges
├── 2021-04-06-intervening-verbiage
│ ├── challenge.md
│ ├── lib
│ │ └── junit-platform-console-standalone-1.8.0-M1.jar
│ ├── mob.java
│ ├── solutions
│ │ ├── JavaScript
│ │ │ └── mrumiker
│ │ │ │ └── mrumiker.js
│ │ ├── bash
│ │ │ └── drkennetz
│ │ │ │ ├── drkennetz.bats
│ │ │ │ └── drkennetz.sh
│ │ ├── c#
│ │ │ ├── Program.cs
│ │ │ └── c#.csproj
│ │ ├── dart
│ │ │ └── ericwburden
│ │ │ │ └── ericwburden.dart
│ │ ├── java
│ │ │ ├── beccani
│ │ │ │ └── beccani.java
│ │ │ ├── jesse-moore
│ │ │ │ └── jesse-moore.java
│ │ │ └── sumanthtatipamula
│ │ │ │ └── sumanthtatipamula.java
│ │ ├── python
│ │ │ └── drkennetz.py
│ │ │ │ └── drkennetz.py
│ │ ├── ruby
│ │ │ └── parhaml
│ │ │ │ └── parhaml.rb
│ │ └── scala
│ │ │ └── julian-a-avar-c
│ │ │ ├── julian-a-avar-c.scala
│ │ │ └── julian-a-avar-c.test.scala
│ ├── src
│ │ ├── main
│ │ │ └── java
│ │ │ │ └── io
│ │ │ │ └── codeconnector
│ │ │ │ └── codedojo
│ │ │ │ └── InterveningVerbiage.java
│ │ └── test
│ │ │ └── java
│ │ │ └── io
│ │ │ └── codeconnector
│ │ │ └── codedojo
│ │ │ └── InterveningVerbiageTest.java
│ ├── test-it.sh
│ └── test.java
├── 2021-04-13-single-and-ready-to-mingle
│ ├── challenge.md
│ ├── package-lock.json
│ ├── package.json
│ ├── solution.js
│ ├── solution.test.js
│ ├── solutions
│ │ ├── csharp
│ │ │ └── coleboren
│ │ │ │ ├── SingleAndReadyToMingle.sln
│ │ │ │ ├── src
│ │ │ │ └── SingleAndReadyToMingle
│ │ │ │ │ ├── Program.cs
│ │ │ │ │ ├── SingleAndReadyToMingle.csproj
│ │ │ │ │ └── Singles.cs
│ │ │ │ └── test
│ │ │ │ └── SingleAndReadyToMingle.Tests
│ │ │ │ ├── SingleAndReadyToMingle.Tests.csproj
│ │ │ │ └── SingleAndReadyToMingleTest.cs
│ │ ├── java
│ │ │ └── jesse-moore
│ │ │ │ └── SingleAndReadyToMingle.java
│ │ ├── javascript
│ │ │ ├── doublebridges
│ │ │ │ └── doublebridges.js
│ │ │ ├── mrumiker
│ │ │ │ └── mrumiker.js
│ │ │ └── parhaml
│ │ │ │ └── parhaml.js
│ │ ├── python
│ │ │ └── xcelr8
│ │ │ │ └── xcelr8.py
│ │ ├── ruby
│ │ │ └── ericwburden
│ │ │ │ └── ericwburden.rb
│ │ ├── typescript
│ │ │ └── ericwburden
│ │ │ │ └── ericwburden.ts
│ │ └── xor-solution-explanation.odp
│ └── test-it.sh
├── 2021-04-20-potential-palindrome
│ ├── challenge.md
│ ├── lib
│ │ └── junit-platform-console-standalone-1.8.0-M1.jar
│ ├── mob.java
│ ├── solutions
│ │ ├── R
│ │ │ └── ericwburden
│ │ │ │ └── ericwburden.R
│ │ ├── bash
│ │ │ └── drkennetz
│ │ │ │ ├── drkennetz.bats
│ │ │ │ └── drkennetz.sh
│ │ ├── cpp
│ │ │ └── juliocvaz
│ │ │ │ ├── Makefile
│ │ │ │ ├── juliocvaz
│ │ │ │ └── juliocvaz.cpp
│ │ ├── githubusername.lang
│ │ ├── go
│ │ │ └── drkennetz
│ │ │ │ ├── drkennetz.go
│ │ │ │ └── drkennetz_test.go
│ │ ├── java
│ │ │ └── ericwburden
│ │ │ │ └── ericwburden.java
│ │ ├── python
│ │ │ └── laurelin
│ │ │ │ ├── laurelin.py
│ │ │ │ └── laurelin_test.py
│ │ ├── ruby
│ │ │ └── parhaml
│ │ │ │ └── parhaml.rb
│ │ └── rust
│ │ │ └── ericwburden
│ │ │ └── ericwburden.rs
│ ├── src
│ │ ├── main
│ │ │ └── java
│ │ │ │ └── io
│ │ │ │ └── codeconnector
│ │ │ │ └── codedojo
│ │ │ │ └── PotentialPalindrome.java
│ │ └── test
│ │ │ └── java
│ │ │ └── io
│ │ │ └── codeconnector
│ │ │ └── codedojo
│ │ │ └── PotentialPalindromeTest.java
│ ├── test-it.sh
│ └── test.java
├── 2021-04-27-sum-arrays
│ ├── challenge.md
│ ├── solutions
│ │ ├── da-vinci-noob.rb
│ │ ├── rust
│ │ │ └── ericwburden
│ │ │ │ ├── ericwburden.R
│ │ │ │ └── ericwburden.rs
│ │ └── yourgituser.rb
│ └── src
│ │ ├── Gemfile
│ │ ├── Gemfile.lock
│ │ ├── spec
│ │ └── test_array_spec.rb
│ │ └── sum_arrays.rb
├── 2021-05-04-a-box-in-a-box
│ ├── challenge.md
│ ├── package-lock.json
│ ├── package.json
│ ├── solution.test.js
│ ├── solutions
│ │ ├── R
│ │ │ └── ericwburden
│ │ │ │ └── ericwburden.R
│ │ ├── go
│ │ │ ├── birenderjit
│ │ │ │ ├── birenderjit.go
│ │ │ │ ├── birenderjit_test.go
│ │ │ │ └── go.mod
│ │ │ └── drkennetz
│ │ │ │ ├── drkennetz.go
│ │ │ │ ├── drkennetz_test.go
│ │ │ │ └── go.mod
│ │ ├── java
│ │ │ └── hasancbngl.js
│ │ │ │ └── hasancbngl.js
│ │ ├── python
│ │ │ └── xanderyzwich
│ │ │ │ └── xanderyzwich.py
│ │ ├── rust
│ │ │ └── oktak
│ │ │ │ ├── README.md
│ │ │ │ └── oktak.rs
│ │ └── yourgithubusername.lang
│ └── test-it.sh
├── 2021-05-11-nonconstructible-change
│ ├── NonConstructibleChange.java
│ ├── challenge.md
│ ├── solutions
│ │ ├── JavaScript
│ │ │ └── mrumiker
│ │ │ │ └── mrumiker.js
│ │ ├── java
│ │ │ └── milaguileras
│ │ │ │ └── milaguileras.java
│ │ └── python
│ │ │ ├── non_constructible_change.py
│ │ │ └── non_constructible_change_test.py
│ └── test-it.sh
├── 2021-05-18-sum-of-squares
│ ├── challenge.md
│ ├── go.mod
│ ├── solution.go
│ ├── solution_test.go
│ └── solutions
│ │ ├── Python
│ │ └── mrumiker.py
│ │ ├── R
│ │ └── ericwburden
│ │ │ └── ericwburden.R
│ │ ├── go
│ │ └── drkennetz
│ │ │ ├── go.mod
│ │ │ ├── solution.go
│ │ │ └── solution_test.go
│ │ ├── java
│ │ └── divyansh-ag-03
│ │ │ └── divyanshAg03.java
│ │ └── rust
│ │ └── ericwburden
│ │ └── ericwburden.rs
├── 2021-05-25-dictionary-decompression
│ ├── challenge.md
│ ├── solution.py
│ └── solutions
│ │ ├── R
│ │ └── ericwburden
│ │ │ └── ericwburden.R
│ │ └── python
│ │ └── xanderyzwich
│ │ └── stack_abuse.py
├── 2021-06-01-find-three-largest-numbers
│ ├── Solution.java
│ ├── challenge.md
│ ├── run-tests.sh
│ └── solutions
│ │ ├── JavaScript
│ │ └── mrumiker
│ │ │ └── mrumiker.js
│ │ ├── go
│ │ └── drkennetz
│ │ │ ├── drkennetz.go
│ │ │ ├── drkennetz_test.go
│ │ │ └── go.mod
│ │ ├── java
│ │ └── mob
│ │ │ └── mob.java
│ │ ├── python
│ │ └── xanderyzwich.py
│ │ └── rust
│ │ └── ericwburden
│ │ └── ericwburden.rs
├── 2021-06-08-simple-2d-iterator
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests.sh
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── java
│ │ └── codingis4noobs2
│ │ │ └── Codingis4noobs2.java
│ │ ├── javascript
│ │ └── mob
│ │ │ └── mob.js
│ │ └── r
│ │ └── ericwburden
│ │ └── ericwburden.R
├── 2021-06-15-square-maze
│ ├── challenge.md
│ ├── solutions
│ │ ├── ruby
│ │ │ ├── mob
│ │ │ │ └── mob.rb
│ │ │ └── yourgituser.rb
│ │ └── rust
│ │ │ └── ericwburden
│ │ │ └── ericwburden.rs
│ └── src
│ │ ├── Gemfile
│ │ ├── Gemfile.lock
│ │ ├── mob.rb
│ │ └── spec
│ │ └── square_maze_spec.rb
├── 2021-06-29-run-of-ones
│ ├── RunOfOnes.java
│ ├── challenge.md
│ ├── run-tests.sh
│ └── solutions
│ │ ├── java
│ │ ├── mob
│ │ │ └── mob.java
│ │ └── onesirian.java
│ │ ├── javascript
│ │ └── mrumiker.js
│ │ └── rust
│ │ └── ericwburden
│ │ └── ericwburden.rs
├── 2021-07-13-coin-counter
│ ├── build.gradle.kts
│ ├── challenge.md
│ ├── gradlew
│ ├── run_tests
│ ├── solutions
│ │ └── kotlin
│ │ │ └── hasancbngl
│ │ │ └── mob.kt
│ └── src
│ │ ├── main
│ │ └── kotlin
│ │ │ └── Solution.kt
│ │ └── test
│ │ └── kotlin
│ │ └── SolutionTest.kt
├── 2021-07-20-balanced-brackets
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests.sh
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── bash
│ │ └── ericwburden
│ │ │ ├── ericwburden.sh
│ │ │ └── ericwburden_test.sh
│ │ ├── javascript
│ │ ├── mob
│ │ │ ├── .placeholder
│ │ │ └── mob.js
│ │ └── mrumiker.js
│ │ ├── python
│ │ └── laurelin
│ │ │ ├── laurelin.py
│ │ │ └── laurelin_test.py
│ │ └── r
│ │ └── ericwburden
│ │ └── ericwburden.R
├── 2021-07-27-boustrophedon
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests.sh
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── javascript
│ │ ├── brehberg
│ │ │ └── brehberg.js
│ │ └── mob
│ │ │ ├── .placeholder
│ │ │ └── mob.js
│ │ ├── julia
│ │ └── ericwburden
│ │ │ └── ericwburden.jl
│ │ └── typescript
│ │ ├── jest.config.js
│ │ ├── package.json
│ │ └── xanderyzwich
│ │ ├── solution.test.ts
│ │ └── solution.ts
├── 2021-08-03-tracing-triangles
│ ├── TracingTriangles.cs
│ ├── TracingTriangles.csproj
│ ├── challenge.md
│ ├── run-tests
│ └── solutions
│ │ ├── csharp
│ │ └── mob
│ │ │ ├── .placeholder
│ │ │ └── mob.cs
│ │ ├── go
│ │ └── drkennetz
│ │ │ ├── drkennetz.go
│ │ │ ├── drkennetz_test.go
│ │ │ └── go.mod
│ │ ├── javascript
│ │ └── mrumiker
│ │ │ └── mrumiker.js
│ │ ├── julia
│ │ └── ericwburden
│ │ │ └── ericwburden.jl
│ │ └── python
│ │ └── xanderyzwich.py
├── 2021-08-10-sort-window
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ └── javascript
│ │ ├── JenniferToops
│ │ └── jennifertoops.js
│ │ ├── mob
│ │ └── .placeholder
│ │ └── mrumiker
│ │ └── mrumiker.js
├── 2021-08-17-friend-finder
│ ├── FriendFinder.java
│ ├── challenge.md
│ ├── run-tests
│ └── solutions
│ │ ├── java
│ │ └── brehberg
│ │ │ └── FriendFinder.java
│ │ ├── javascript
│ │ ├── mob
│ │ │ └── .placeholder
│ │ └── mrumiker
│ │ │ └── mrumiker.js
│ │ └── python
│ │ └── xanderyzwich.py
├── 2021-08-24-dominoes-descending
│ ├── challenge.md
│ ├── go.mod
│ ├── solution.go
│ ├── solution_test.go
│ └── solutions
│ │ ├── JavaScript
│ │ └── mrumiker
│ │ │ ├── mrumiker1.js
│ │ │ └── mrumiker2.js
│ │ └── julia
│ │ └── ericwburden
│ │ ├── ericwburden.jl
│ │ └── ericwburden_tests.jl
├── 2021-08-31-zero-point
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── javascript
│ │ └── mob
│ │ │ ├── .placeholder
│ │ │ └── mob.js
│ │ ├── python
│ │ └── drkennetz
│ │ │ ├── README.md
│ │ │ ├── test
│ │ │ └── test_zeropoint.py
│ │ │ └── zeropoint
│ │ │ ├── LinkedList.py
│ │ │ └── zeropoint.py
│ │ └── rust
│ │ └── ericwburden
│ │ └── ericwburden.rs
├── 2021-09-14-fast-peak-picker
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── go
│ │ └── drkennetz
│ │ │ ├── drkennetz.go
│ │ │ ├── drkennetz_test.go
│ │ │ └── go.mod
│ │ └── javascript
│ │ ├── mob
│ │ ├── .placeholder
│ │ └── mob.js
│ │ └── mrumiker
│ │ └── mrumiker.js
├── 2021-09-20-tic-tac-toe-winner
│ ├── challenge.md
│ └── solutions
│ │ ├── JavaScript
│ │ └── mrumiker
│ │ │ └── mrumiker.js
│ │ ├── R
│ │ └── ericwburden
│ │ │ └── ericwburden.R
│ │ ├── python
│ │ └── xanderyzwich
│ │ │ └── solution.py
│ │ └── ruby
│ │ ├── Gemfile
│ │ ├── Gemfile.lock
│ │ ├── brehberg
│ │ └── brehberg.rb
│ │ ├── mob.rb
│ │ └── tic_tac_test.rb
├── 2021-09-28-minimum-impossible-sum
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ └── mob
│ │ ├── .placeholder
│ │ └── mob.js
├── 2021-10-05-limited-levenshtein-leap
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── mob
│ │ ├── .placeholder
│ │ ├── JavaScript
│ │ │ └── mrumiker
│ │ │ │ └── mrumiker.js
│ │ └── mob.js
│ │ ├── python
│ │ └── xanderyzwich.py
│ │ └── rust
│ │ └── ericwburden
│ │ └── ericwburden.rs
├── 2021-10-12-monotonic-array
│ ├── challenge.md
│ ├── package.json
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── JavaScript
│ │ └── mrumiker
│ │ │ └── mrumiker.js
│ │ ├── bash
│ │ └── ericwburden
│ │ │ ├── ericwburden.sh
│ │ │ └── ericwburden_test.sh
│ │ ├── javascript
│ │ └── brehberg
│ │ │ └── brehberg.js
│ │ ├── mob
│ │ ├── .placeholder
│ │ └── mob.js
│ │ └── python
│ │ └── xanderyzwich.py
├── 2021-10-19-zig-zag-print
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── javascript
│ │ └── brehberg
│ │ │ └── brehberg.js
│ │ └── mob
│ │ └── mob.js
├── 2021-10-26-the-24-game
│ ├── challenge.md
│ ├── run-tests
│ ├── solution.py
│ └── solutions
│ │ └── mob
│ │ ├── .placeholder
│ │ └── mob.py
├── 2021-11-02-pragmatic-pipes
│ ├── challenge.md
│ ├── solution
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── lib.rs
│ └── solutions
│ │ └── mob
│ │ ├── .placeholder
│ │ └── mob.rs
├── 2021-11-09-look-and-say-sequence
│ ├── challenge.md
│ ├── solution
│ │ ├── Cargo.lock
│ │ ├── Cargo.toml
│ │ └── src
│ │ │ └── lib.rs
│ └── solutions
│ │ ├── JavaScript
│ │ └── mrumiker
│ │ │ └── mrumiker.js
│ │ ├── go
│ │ └── drkennetz
│ │ │ ├── drkennetz.go
│ │ │ ├── drkennetz_test.go
│ │ │ └── go.mod
│ │ └── mob
│ │ ├── .placeholder
│ │ └── mob.rs
├── 2021-11-16-data-grouping
│ ├── HS_ACT_Data.txt
│ ├── challenge.md
│ ├── generate_random_hs.py
│ ├── solution.py
│ └── solutions
│ │ ├── R
│ │ └── ericwburden
│ │ │ └── ericwburden.R
│ │ ├── javascript
│ │ └── justinmemphis
│ │ │ ├── justinmemphis.js
│ │ │ ├── justinmemphis.test.js
│ │ │ └── package.json
│ │ └── mob
│ │ └── .placeholder
├── 2021-11-30-weird-column-naming
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── go
│ │ └── drkennetz
│ │ │ ├── drkennetz.go
│ │ │ ├── drkennetz_test.go
│ │ │ └── go.mod
│ │ ├── javascript
│ │ └── JenniferToops
│ │ │ └── jennifertoops.js
│ │ ├── mob
│ │ └── .placeholder
│ │ └── r
│ │ └── ericwburden
│ │ └── ericwburden.R
├── 2022-01-18-planet-express
│ ├── PlanetExpress.cs
│ ├── PlanetExpress.csproj
│ ├── challenge.md
│ ├── run-tests
│ └── solutions
│ │ ├── R
│ │ └── ericwburden
│ │ │ └── ericwburden.R
│ │ ├── csharp
│ │ └── mob
│ │ │ ├── .placeholder
│ │ │ └── mob.cs
│ │ └── go
│ │ └── drkennetz
│ │ ├── drkennetz.go
│ │ ├── drkennetz_test.go
│ │ ├── go.mod
│ │ └── go.sum
├── 2022-01-25-move-element-to-end
│ ├── MoveElementToEnd.java
│ ├── challenge.md
│ ├── run-tests
│ └── solutions
│ │ ├── csharp
│ │ └── mrumiker
│ │ │ ├── README.md
│ │ │ ├── src
│ │ │ └── MoveToEndChallenge
│ │ │ │ ├── MoveToEndChallenge.csproj
│ │ │ │ ├── Program.cs
│ │ │ │ └── Solution.cs
│ │ │ └── test
│ │ │ └── MoveToEndChallenge.Tests
│ │ │ ├── ChallengeTests.cs
│ │ │ └── MoveToEndChallenge.Tests.csproj
│ │ ├── java
│ │ └── mob
│ │ │ └── Solutions.java
│ │ └── rust
│ │ └── ericwburden
│ │ └── ericwburden.rs
├── 2022-02-01-greedy-goblin
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── javascript
│ │ └── mob
│ │ │ ├── .placeholder
│ │ │ └── mob.js
│ │ └── julia
│ │ └── ericwburden
│ │ └── ericwburden.jl
├── 2022-02-09-simple-db
│ ├── challenge.md
│ ├── run-tests
│ ├── solution.py
│ └── solutions
│ │ ├── go
│ │ └── drkennetz
│ │ │ ├── drkennetz.go
│ │ │ ├── drkennetz_test.go
│ │ │ ├── go.mod
│ │ │ └── go.sum
│ │ └── python
│ │ └── mob
│ │ └── mob.py
├── 2022-02-14-three-number-sort
│ ├── ThreeNumberSort.cs
│ ├── ThreeNumberSort.csproj
│ ├── challenge.md
│ ├── run-tests
│ └── solutions
│ │ └── csharp
│ │ ├── mob
│ │ └── .placeholder
│ │ └── mrumiker
│ │ └── mrumiker.cs
├── 2022-02-22-jump-around
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── javascript
│ │ ├── mob
│ │ │ └── solution.js
│ │ └── mrumiker
│ │ │ └── mrumiker.js
│ │ └── python
│ │ └── xanderyzwich.py
├── 2022-03-01-longest-peak
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── javascript
│ │ ├── brehberg
│ │ │ └── brehberg.js
│ │ └── mob
│ │ │ └── .placeholder
│ │ └── python
│ │ └── xanderyzwich.py
├── 2022-03-08-hidden-digits
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── javascript
│ │ ├── brehberg
│ │ │ └── brehberg.js
│ │ └── mob
│ │ │ ├── .placeholder
│ │ │ └── mob.js
│ │ ├── python
│ │ ├── drkennetz
│ │ │ └── test_drkennetz.py
│ │ └── xanderyzwich
│ │ │ └── xanderyzwich.py
│ │ └── rust
│ │ └── ericwburden
│ │ └── ericwburden.rs
├── 2022-03-15-longest-common-prefix
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── javascript
│ │ └── mob
│ │ │ ├── .placeholder
│ │ │ └── mob.js
│ │ ├── julia
│ │ └── ericwburden
│ │ │ └── ericwburden.jl
│ │ ├── python
│ │ └── xanderyzwich.py
│ │ └── rust
│ │ └── ericwburden
│ │ └── ericwburden.rs
├── 2022-03-29-search-party
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── javascript
│ │ ├── EvilTables
│ │ │ └── MattFeeSolution.js
│ │ ├── matthewfee
│ │ │ └── matthewFeeSolution.js
│ │ └── mob
│ │ │ ├── .placeholder
│ │ │ └── mob-solution.js
│ │ └── rust
│ │ └── ericwburden
│ │ └── ericwburden.rs
├── 2022-04-05-pascals-triangle
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── javascript
│ │ ├── brehberg
│ │ │ └── brehberg.js
│ │ └── mob
│ │ │ ├── .placeholder
│ │ │ └── mob.js
│ │ └── python
│ │ └── xcelr8
│ │ └── xcelr8.py
├── 2022-04-12-skip-counting
│ ├── SkipCounting.java
│ ├── challenge.md
│ ├── run-tests
│ └── solutions
│ │ ├── java
│ │ ├── brehberg
│ │ │ └── SkipCounting.java
│ │ └── mob
│ │ │ ├── .placeholder
│ │ │ └── mob.java
│ │ ├── javascript
│ │ ├── matthewfee
│ │ │ └── solution.js
│ │ └── saimaheshtaduri
│ │ │ └── solution.js
│ │ └── julia
│ │ └── ericwburden
│ │ └── ericwburden.jl
├── 2022-04-19-intro-to-advent-of-code
│ └── aoc_2019_01
│ │ ├── Manifest.toml
│ │ ├── Project.toml
│ │ ├── src
│ │ └── aoc_2019_01.jl
│ │ └── test
│ │ └── runtests.jl
├── 2022-04-26-dojo-anniversary-edition
│ ├── challenge.md
│ ├── javascript
│ │ ├── package.json
│ │ ├── run-tests
│ │ ├── solution.js
│ │ └── solution.test.js
│ ├── julia
│ │ ├── Manifest.toml
│ │ ├── Project.toml
│ │ ├── README.md
│ │ └── src
│ │ │ └── julia.jl
│ ├── rust
│ │ ├── Cargo.toml
│ │ ├── README.md
│ │ └── src
│ │ │ └── lib.rs
│ └── solutions
│ │ ├── javascript
│ │ ├── .placeholder
│ │ ├── dekotanelson
│ │ │ ├── package.json
│ │ │ ├── run-tests
│ │ │ ├── solution.js
│ │ │ └── solution.test.js
│ │ └── matthewfee
│ │ │ └── Level4.js
│ │ ├── julia
│ │ └── .placeholder
│ │ └── rust
│ │ └── .placeholder
├── 2022-06-14-two-sum-numbers
│ ├── TwoSumNumbers.cs
│ ├── TwoSumNumbers.csproj
│ ├── challenge.md
│ ├── run-tests
│ └── solutions
│ │ ├── csharp
│ │ └── mob
│ │ │ ├── .placeholder
│ │ │ └── mob.cs
│ │ ├── javascript
│ │ └── Moses-Alero
│ │ │ └── TwosumNumbers.js
│ │ └── python
│ │ └── xcelr8
│ │ └── xcelr8.py
├── 2022-07-12-node-depths
│ ├── Solution.java
│ ├── challenge.md
│ ├── run-tests
│ └── solutions
│ │ ├── go
│ │ └── drkennetz
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── nodeDepths.go
│ │ │ └── nodeDepths_test.go
│ │ ├── java
│ │ └── mob
│ │ │ ├── .placeholder
│ │ │ └── mob.java
│ │ └── rust
│ │ └── ericwburden
│ │ └── ericwburden.rs
├── 2022-08-09-critter-crossing
│ ├── Solution.java
│ ├── challenge.md
│ ├── run-tests
│ └── solutions
│ │ ├── java
│ │ ├── corey
│ │ │ └── Corey.java
│ │ └── mob
│ │ │ ├── .placeholder
│ │ │ └── Mob.java
│ │ ├── python
│ │ └── Moses-Alero
│ │ │ └── critterCrossing.py
│ │ └── rust
│ │ └── ericwburden
│ │ └── ericwburden.rs
├── 2022-09-12-find-those-fives
│ ├── challenge.md
│ ├── setups
│ │ └── javascript
│ │ │ ├── info.md
│ │ │ ├── package.json
│ │ │ ├── solution.js
│ │ │ └── solution.test.js
│ ├── solution.jl
│ ├── solutions
│ │ ├── javascript
│ │ │ └── justinmemphis.js
│ │ └── julia
│ │ │ └── mob
│ │ │ ├── .placeholder
│ │ │ ├── mob.jl
│ │ │ └── reasoning.pdf
│ └── test.jl
├── 2022-10-11-blast-from-the-past
│ ├── challenge.md
│ ├── setups
│ │ ├── csharp
│ │ │ ├── BlastfromthePast.cs
│ │ │ ├── BlastfromthePast.csproj
│ │ │ ├── info.md
│ │ │ └── run-tests
│ │ ├── go
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── info.md
│ │ │ ├── solution.go
│ │ │ └── solution_test.go
│ │ ├── java
│ │ │ ├── Solution.java
│ │ │ ├── info.md
│ │ │ └── run-tests
│ │ ├── javascript
│ │ │ ├── info.md
│ │ │ ├── package.json
│ │ │ ├── solution.js
│ │ │ └── solution.test.js
│ │ ├── julia
│ │ │ ├── info.md
│ │ │ └── solution.jl
│ │ ├── kotlin
│ │ │ ├── .gitignore
│ │ │ ├── build.gradle.kts
│ │ │ ├── info.md
│ │ │ ├── run_tests
│ │ │ └── src
│ │ │ │ ├── main
│ │ │ │ └── kotlin
│ │ │ │ │ └── Solution.kt
│ │ │ │ └── test
│ │ │ │ └── kotlin
│ │ │ │ └── SolutionTest.kt
│ │ ├── python
│ │ │ ├── info.md
│ │ │ └── solution.py
│ │ ├── ruby
│ │ │ ├── info.md
│ │ │ └── solution.rb
│ │ └── rust
│ │ │ ├── Cargo.toml
│ │ │ ├── info.md
│ │ │ └── src
│ │ │ └── lib.rs
│ └── solutions
│ │ ├── .placeholder
│ │ ├── csharp
│ │ └── mrumiker
│ │ │ └── mrumiker.cs
│ │ ├── go
│ │ └── drkennetz
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── solution.go
│ │ │ └── solution_test.go
│ │ ├── javascript
│ │ ├── Harrified
│ │ │ └── solution.js
│ │ ├── brehberg
│ │ │ └── brehberg.js
│ │ ├── justinmemphis
│ │ │ └── justinmemphis.js
│ │ └── moses-alero
│ │ │ ├── info.md
│ │ │ ├── package.json
│ │ │ ├── solution.js
│ │ │ └── solution.test.js
│ │ ├── julia
│ │ └── ericwburden
│ │ │ └── ericwburden.jl
│ │ └── python
│ │ └── justinmemphis
│ │ └── justinmemphis.py
├── 2022-11-08-common-elements
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ └── javascript
│ │ └── mob
│ │ ├── .placeholder
│ │ └── mob.js
├── 2023-02-14-valid-starting-city
│ ├── challenge.md
│ ├── solution.py
│ └── solutions
│ │ ├── python
│ │ └── mob
│ │ │ ├── .placeholder
│ │ │ └── solution.py
│ │ └── rust
│ │ └── ericwburden
│ │ └── ericwburden.rs
├── 2023-04-11-search-sorted-matrix
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ └── javascript
│ │ ├── .placeholder
│ │ └── mob.js
├── 2023-05-09-class-photos
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ └── javascript
│ │ ├── .placeholder
│ │ └── mob.js
├── 2023-06-13-mayan-days
│ ├── challenge.md
│ ├── setup.cfg
│ ├── setup.py
│ ├── solution.py
│ ├── solutions
│ │ └── python
│ │ │ ├── .placeholder
│ │ │ └── mob.py
│ └── test_validation.py
├── 2023-08-08-how-much-water
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ └── javascript
│ │ ├── .placeholder
│ │ └── mob.js
├── 2023-09-12-count-voice-votes
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ ├── elixir
│ │ └── brehberg
│ │ │ ├── .gitignore
│ │ │ ├── lib
│ │ │ └── count_voice_votes.ex
│ │ │ ├── mix.exs
│ │ │ └── test
│ │ │ ├── count_voice_votes_test.exs
│ │ │ └── test_helper.exs
│ │ └── javascript
│ │ ├── .placeholder
│ │ └── mob.js
├── 2023-11-14-mirror-words
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ └── javascript
│ │ ├── .placeholder
│ │ └── mob.js
├── 2024-01-09-maximul-non-adjacent-sum
│ ├── challenge.md
│ ├── package.json
│ ├── run-tests
│ ├── solution.js
│ ├── solution.test.js
│ └── solutions
│ │ └── javascript
│ │ └── mob.js
├── 2024-02-12-contains-nearby-dups
│ ├── challenge.md
│ ├── solution.py
│ └── solutions
│ │ └── python
│ │ ├── mob.py
│ │ └── mob
│ │ └── .placeholder
├── 2024-03-12-merge-sorted-array
│ ├── challenge.md
│ ├── solution.py
│ └── solutions
│ │ └── mob
│ │ └── .placeholder
└── 2024-10-08-name-that-number
│ ├── NameThatNumber.cs
│ ├── NameThatNumber.csproj
│ ├── challenge.md
│ └── run-tests
├── codingdojo-logo.png
├── docs
├── leadership_onboarding-doc.md
└── pull_request_template.md
├── logo.html
└── resources
├── README.md
├── csharp
├── Sample.csproj
└── csharp-test-runner.sh
├── java
├── java-test-runner.sh
└── junit5-1.8.0-M1.jar
├── javascript
├── js-test-runner.sh
└── package.json
├── kotlin
├── build.gradle.kts
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
└── run_tests.sh
└── python
└── python-test-runner.sh
/.gitattributes:
--------------------------------------------------------------------------------
1 | test-it.sh linguist-detectable=false
2 | run-tests.sh linguist-detectable=false
3 | run-tests linguist-detectable=false
4 | *-test-runner.sh linguist-detectable=false
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | out/*
2 | *.class
3 | *.iml
4 | **/.DS_Store
5 | **/.gradle
6 | **/build
7 | **/node_modules
8 | **/.xml
9 | **/.idea
10 | **.pyc
11 | **/*dll
12 | **/*.exe
13 | **/*.html
14 | **/*.json
15 | **/*.cache
16 | **/*.txt
17 | **/*.CopyComplete
18 | **/*.pdb
19 | **/*.targets
20 | **/*.props
21 | **/*.Assembly*
22 | **/target
23 | **/Cargo.lock
24 | **/.scala-build
25 | **/.bsp
26 |
27 | # Include the `package.json` files
28 | !**/package.json
29 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "java.project.referencedLibraries": [
3 | "lib/**/*.jar",
4 | "resources/java/junit5-1.8.0-M1.jar"
5 | ]
6 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Code Connector
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/REVIEWERS.md:
--------------------------------------------------------------------------------
1 | # Reviewers
2 |
3 | The list below includes the people that will be doing code reviews for submissions and the langages that they know (with varying degrees of knowledge).
4 |
5 | ## Eric Burden
6 |
7 | + R
8 | + Python
9 | + Rust
10 | + JS
11 | + Bash
12 | + Julia
13 |
14 | ## Dennis Kennetz
15 |
16 | + Python
17 | + Go
18 | + Bash
19 |
20 | ## Corey McCarty
21 |
22 | + Java
23 | + Python
24 | + Go
25 | + Groovy
26 | + Bash
27 |
28 | ## Charles Umiker
29 |
30 | + JS
31 | + Python
32 | + C#
33 |
34 | ## Lee Parham
35 |
36 | + Ruby
37 |
38 | ## Cole Boren
39 |
40 | + JS
41 | + C#
42 | + Java
43 | + Python
44 |
45 |
--------------------------------------------------------------------------------
/challenges/2021-04-06-intervening-verbiage/lib/junit-platform-console-standalone-1.8.0-M1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-04-06-intervening-verbiage/lib/junit-platform-console-standalone-1.8.0-M1.jar
--------------------------------------------------------------------------------
/challenges/2021-04-06-intervening-verbiage/mob.java:
--------------------------------------------------------------------------------
1 | src/main/java/io/codeconnector/codedojo/InterveningVerbiage.java
--------------------------------------------------------------------------------
/challenges/2021-04-06-intervening-verbiage/solutions/JavaScript/mrumiker/mrumiker.js:
--------------------------------------------------------------------------------
1 | function interveningVerbiage(word1, word2, sentence) {
2 |
3 | const strArr = sentence.split(' '),
4 | word1Index = strArr.indexOf(word1),
5 | word2Index = strArr.indexOf(word2);
6 |
7 | if (word1Index === -1 || word2Index === -1) return "The words must be in the list.";
8 |
9 | return Math.abs(word1Index - word2Index) - 1;
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/challenges/2021-04-06-intervening-verbiage/solutions/bash/drkennetz/drkennetz.bats:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bats
2 |
3 | @test "lady-outhouse" {
4 | AT=$(./drkennetz.sh -t 'There was an old lady who lived in an outhouse' -s lady -e outhouse)
5 | GS=4
6 | echo "Expected $GS got $AT"
7 | [ "$AT" = $GS ]
8 | }
9 |
10 | @test "an-outhouse" {
11 | AT=$(./drkennetz.sh -t 'There was an old lady who lived in an outhouse' -s an -e outhouse)
12 | GS=6
13 | echo "Expected $GS got $AT"
14 | [ "$AT" = $GS ]
15 | }
16 |
17 | @test "an-an" {
18 | AT=$(./drkennetz.sh -t 'There was an old lady who lived in an outhouse' -s an -e an)
19 | GS=5
20 | echo "Expected $GS got $AT"
21 | [ "$AT" = $GS ]
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/challenges/2021-04-06-intervening-verbiage/solutions/bash/drkennetz/drkennetz.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | print_help() {
4 | >&2 echo "Usage: drkennetz.sh -t TEST_SENTENCE -s START_WORD -e END_WORD"
5 | }
6 |
7 | TEST_SENTENCE=""
8 | START_WORD=""
9 | END_WORD=""
10 |
11 | while [[ ! -z "$1" ]]; do
12 | case $1 in
13 | -t) TEST_SENTENCE=$2; shift;;
14 | -s) START_WORD=$2; shift;;
15 | -e) END_WORD=$2; shift;;
16 | -h) print_help && exit 1;;
17 | *) >&2 echo "Unrecognized option $1" && print_help && exit 1;;
18 | esac
19 | shift
20 | done
21 | if [[ -z "$TEST_SENTENCE" ]] || [[ -z "$START_WORD" ]] || [[ -z "$END_WORD" ]]; then
22 | echo "Missing an argument" && print_help && exit 1
23 | fi
24 |
25 | result=$(echo "$TEST_SENTENCE" | grep -oiP '(?<='$START_WORD').*?(?='$END_WORD')')
26 | echo $result | wc -w
27 |
--------------------------------------------------------------------------------
/challenges/2021-04-06-intervening-verbiage/solutions/c#/c#.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net5.0
6 | c_
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/challenges/2021-04-06-intervening-verbiage/solutions/ruby/parhaml/parhaml.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require 'test/unit/assertions'
4 | include Test::Unit::Assertions
5 |
6 |
7 | # Given the sentence:
8 | # There was an old lady who lived in an outhouse
9 | def count_words_between(start, stop, sentence)
10 | # partition will return ["There was an old ", "lady", " who lived in an outhouse"]
11 | sentence_after_start = sentence.partition(start).last # the last value being " who lived in an outhouse"
12 |
13 | # partition will return [" who lived in an ", "outhouse", ""]
14 | sentence_before_stop = sentence_after_start.partition(stop).first # the first value being " who lived in an "
15 |
16 | # split will return ["who", "lived", "in", "an"]
17 | sentence_before_stop.split(' ').count # the count of these values is the # of words between the start and stop
18 | end
19 |
20 | # TESTS
21 | sentence = 'There was an old lady who lived in an outhouse'
22 |
23 | start = 'lady'
24 | stop = 'outhouse'
25 |
26 | assert_equal(4, count_words_between(start, stop, sentence))
27 |
28 | start = 'an'
29 | stop = 'outhouse'
30 | assert_equal(6, count_words_between(start, stop, sentence))
31 |
--------------------------------------------------------------------------------
/challenges/2021-04-06-intervening-verbiage/test.java:
--------------------------------------------------------------------------------
1 | src/test/java/io/codeconnector/codedojo/InterveningVerbiageTest.java
--------------------------------------------------------------------------------
/challenges/2021-04-13-single-and-ready-to-mingle/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "2021-04-13-single-and-ready-to-mingle",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2021-04-13-single-and-ready-to-mingle/solution.js:
--------------------------------------------------------------------------------
1 | // # Single and Ready to Mingle
2 | //
3 | // Given an array of integers in which two elements appear exactly once and all
4 | // other elements appear exactly twice, find the two elements that appear only
5 | // once.
6 | //
7 | // ## Business Rules/Errata
8 | //
9 | // - You can assume that the input will **always** include at least two and
10 | // exactly two elements that appear only once.
11 | // - You may not assume that the list will be sorted ahead of time.
12 | // - Extra Challenge: Can you complete this puzzle in linear time and constant
13 | // space?
14 | // - Extra Extra Challenge: Can you make your solution generic over other input
15 | // types?
16 | // - Extra Extra Extra Challenge: Do it in TypeScript.
17 | //
18 | // ## Examples
19 | //
20 | // ```
21 | // input = [2, 4, 6, 8, 10, 2, 6, 10];
22 | // findSingles(input) // [4, 8]
23 | // ```
24 | // ```
25 | // input = [1, 2, 3, 2, 1, 4, 4, 6, 7, 8, 7, 6, 9, 9];
26 | // findSingles(input) // [3, 8]
27 | // ```
28 |
29 | function findSingles(input) {
30 | // Put your code here to make this fuction work
31 | return input;
32 | }
33 |
34 | module.exports = findSingles;
35 |
--------------------------------------------------------------------------------
/challenges/2021-04-13-single-and-ready-to-mingle/solution.test.js:
--------------------------------------------------------------------------------
1 | const findSingles = require('./solution');
2 |
3 | test('Finds the singles in [2, 4, 6, 8, 10, 2, 6, 10]', () => {
4 | var input = [2, 4, 6, 8, 10, 2, 6, 10];
5 | expect(findSingles(input)).toEqual([4, 8]);
6 | });
7 |
8 | test('Finds the singles in [1, 2, 3, 2, 1, 4, 4, 6, 7, 8, 7, 6, 9, 9]', () => {
9 | var input = [1, 2, 3, 2, 1, 4, 4, 6, 7, 8, 7, 6, 9, 9];
10 | expect(findSingles(input)).toEqual([3, 8]);
11 | });
12 |
--------------------------------------------------------------------------------
/challenges/2021-04-13-single-and-ready-to-mingle/solutions/csharp/coleboren/SingleAndReadyToMingle.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26124.0
5 | MinimumVisualStudioVersion = 15.0.26124.0
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Debug|x64 = Debug|x64
10 | Debug|x86 = Debug|x86
11 | Release|Any CPU = Release|Any CPU
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(SolutionProperties) = preSolution
16 | HideSolutionNode = FALSE
17 | EndGlobalSection
18 | EndGlobal
19 |
--------------------------------------------------------------------------------
/challenges/2021-04-13-single-and-ready-to-mingle/solutions/csharp/coleboren/src/SingleAndReadyToMingle/Program.cs:
--------------------------------------------------------------------------------
1 | // using static Singles;
2 |
3 | namespace SingleAndReadyToMingle
4 | {
5 | class Program
6 | {
7 | static void Main(string[] args)
8 | {
9 | var MyArray1 = new int[] {2, 4, 6, 8, 10, 2, 6, 10};
10 | var singlesArray1 = new Singles();
11 | singlesArray1.GetSingles(MyArray1);
12 |
13 | var MyArray2 = new int[] {1, 2, 3, 2, 1, 4, 4, 6, 7, 8, 7, 6, 9, 9};
14 | var singlesArray2 = new Singles();
15 | singlesArray2.GetSingles(MyArray2);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/challenges/2021-04-13-single-and-ready-to-mingle/solutions/csharp/coleboren/src/SingleAndReadyToMingle/SingleAndReadyToMingle.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | netcoreapp3.1
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/challenges/2021-04-13-single-and-ready-to-mingle/solutions/csharp/coleboren/src/SingleAndReadyToMingle/Singles.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace SingleAndReadyToMingle
6 | {
7 | public class Singles
8 | {
9 | public int[] arrayWithSingles;
10 |
11 | public Singles()
12 | {
13 | //No Args Constructor
14 | }
15 | public int[] GetSingles(int[] array)
16 | {
17 | var arrayList = new List();
18 |
19 | foreach (var number in array)
20 | {
21 | bool isReapted = array.Count(x => x == number) > 1;
22 | if(isReapted == false)
23 | {
24 | arrayList.Add(number);
25 | }
26 | }
27 | arrayList.Sort();
28 | var result = arrayList.ToArray();
29 | Console.WriteLine("Input Array: " + "[{0}]", string.Join(", ", array));
30 | Console.WriteLine("Singles Array: " + "[{0}]", string.Join(", ", result));
31 | Console.WriteLine("\n");
32 | return result;
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/challenges/2021-04-13-single-and-ready-to-mingle/solutions/csharp/coleboren/test/SingleAndReadyToMingle.Tests/SingleAndReadyToMingle.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 |
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/challenges/2021-04-13-single-and-ready-to-mingle/solutions/csharp/coleboren/test/SingleAndReadyToMingle.Tests/SingleAndReadyToMingleTest.cs:
--------------------------------------------------------------------------------
1 | using Xunit;
2 |
3 | namespace SingleAndReadyToMingle.Tests
4 | {
5 | public class SingleAndReadyToMingleTests
6 | {
7 | [Fact]
8 | public void Test1()
9 | {
10 | //Arrange, Act, Assert
11 | var MyArray = new int[] {2, 4, 6, 8, 10, 2, 6, 10};
12 | var singlesArray = new Singles();
13 |
14 | //Act
15 | var result = singlesArray.GetSingles(MyArray);
16 | var expected = new int[] {4,8};
17 |
18 | //Assert
19 | Assert.Equal(result, expected);
20 | }
21 |
22 | [Fact]
23 | public void Test2()
24 | {
25 | //Arrange
26 | var MyArray = new int[] {1, 2, 3, 2, 1, 4, 4, 6, 7, 8, 7, 6, 9, 9};
27 | var singlesArray = new Singles();
28 |
29 | //Act
30 | var result = singlesArray.GetSingles(MyArray);
31 | var expected = new int[] {3,8};
32 |
33 | //Assert
34 | Assert.Equal(result, expected);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/challenges/2021-04-13-single-and-ready-to-mingle/solutions/javascript/doublebridges/doublebridges.js:
--------------------------------------------------------------------------------
1 | // # Single and Ready to Mingle
2 | //
3 | // Given an array of integers in which two elements appear exactly once and all
4 | // other elements appear exactly twice, find the two elements that appear only
5 | // once.
6 | //
7 | // ## Business Rules/Errata
8 | //
9 | // - You can assume that the input will **always** include at least two and
10 | // exactly two elements that appear only once.
11 | // - You may not assume that the list will be sorted ahead of time.
12 | // - Extra Challenge: Can you complete this puzzle in linear time and constant
13 | // space?
14 | // - Extra Extra Challenge: Can you make your solution generic over other input
15 | // types?
16 | // - Extra Extra Extra Challenge: Do it in TypeScript.
17 | //
18 | // ## Examples
19 | //
20 | // ```
21 | // input = [2, 4, 6, 8, 10, 2, 6, 10];
22 | // findSingles(input) // [4, 8]
23 | // ```
24 | // ```
25 | // input = [1, 2, 3, 2, 1, 4, 4, 6, 7, 8, 7, 6, 9, 9];
26 | // findSingles(input) // [3, 8]
27 | // ```
28 |
29 | function findSingles(input) {
30 | let ansArr = [];
31 | for (let idx in input) {
32 | let val = input[idx]
33 | if (!ansArr.includes(val)) {
34 | ansArr.push(val)
35 | } else {
36 | ansArr.splice(ansArr.indexOf(val), 1)
37 | }
38 | }
39 | return ansArr;
40 | }
41 |
42 |
43 |
44 | module.exports = findSingles;
45 |
--------------------------------------------------------------------------------
/challenges/2021-04-13-single-and-ready-to-mingle/solutions/javascript/mrumiker/mrumiker.js:
--------------------------------------------------------------------------------
1 | const findSingles = (input) => input.filter(x => input.indexOf(x) === input.lastIndexOf(x));
2 |
--------------------------------------------------------------------------------
/challenges/2021-04-13-single-and-ready-to-mingle/solutions/javascript/parhaml/parhaml.js:
--------------------------------------------------------------------------------
1 | // # Single and Ready to Mingle
2 | //
3 | // Given an array of integers in which two elements appear exactly once and all
4 | // other elements appear exactly twice, find the two elements that appear only
5 | // once.
6 | //
7 | // ## Business Rules/Errata
8 | //
9 | // - You can assume that the input will **always** include at least two and
10 | // exactly two elements that appear only once.
11 | // - You may not assume that the list will be sorted ahead of time.
12 | // - Extra Challenge: Can you complete this puzzle in linear time and constant
13 | // space?
14 | // - Extra Extra Challenge: Can you make your solution generic over other input
15 | // types?
16 | // - Extra Extra Extra Challenge: Do it in TypeScript.
17 | //
18 | // ## Examples
19 | //
20 | // ```
21 | // input = [2, 4, 6, 8, 10, 2, 6, 10];
22 | // findSingles(input) // [4, 8]
23 | // ```
24 | // ```
25 | // input = [1, 2, 3, 2, 1, 4, 4, 6, 7, 8, 7, 6, 9, 9];
26 | // findSingles(input) // [3, 8]
27 | // ```
28 |
29 | function findSingles(input) {
30 | const res = new Set()
31 | for (i = 0; i < input.length; i++) {
32 | let v = input[i]
33 | if (res.has(v)) {
34 | res.delete(v)
35 | } else {
36 | res.add(v)
37 | }
38 | }
39 |
40 |
41 | return Array.from(res);
42 | }
43 |
44 | module.exports = findSingles;
45 |
--------------------------------------------------------------------------------
/challenges/2021-04-13-single-and-ready-to-mingle/solutions/xor-solution-explanation.odp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-04-13-single-and-ready-to-mingle/solutions/xor-solution-explanation.odp
--------------------------------------------------------------------------------
/challenges/2021-04-20-potential-palindrome/lib/junit-platform-console-standalone-1.8.0-M1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-04-20-potential-palindrome/lib/junit-platform-console-standalone-1.8.0-M1.jar
--------------------------------------------------------------------------------
/challenges/2021-04-20-potential-palindrome/mob.java:
--------------------------------------------------------------------------------
1 | src/main/java/io/codeconnector/codedojo/PotentialPalindrome.java
--------------------------------------------------------------------------------
/challenges/2021-04-20-potential-palindrome/solutions/R/ericwburden/ericwburden.R:
--------------------------------------------------------------------------------
1 | library(testthat)
2 | library(purrr)
3 | library(magrittr)
4 |
5 | can_make_palindrome <- function(input) {
6 | input <- as.character(input) %>%
7 | strsplit("") %>%
8 | unlist()
9 | if (length(input) == 0) { return(FALSE) }
10 |
11 | occurrences <- table(input)
12 | unique_occurrences <- map_dbl(occurrences, ~ .x %% 2)
13 | sum(unique_occurrences) <= 1
14 | }
15 |
16 | test_that("'carrace' makes a palindrome", {
17 | expect_true(can_make_palindrome("carrace"))
18 | })
19 |
20 | test_that("41231234 makes a palindrome", {
21 | expect_true(can_make_palindrome(41231234))
22 | })
23 |
24 | test_that("'notapalindrome' does not make a palindrome", {
25 | expect_false(can_make_palindrome("notapalindrome"))
26 | })
27 |
28 | test_that("Empty string is not a palindrome", {
29 | expect_false(can_make_palindrome(""))
30 | })
31 |
--------------------------------------------------------------------------------
/challenges/2021-04-20-potential-palindrome/solutions/bash/drkennetz/drkennetz.bats:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bats
2 |
3 | @test "carrace" {
4 | AT=$(./drkennetz.sh "carrace")
5 | GS="true"
6 | echo "Expected $GS got $AT"
7 | [ "$AT" = $GS ]
8 | }
9 |
10 | @test "41231234" {
11 | AT=$(./drkennetz.sh "41231234")
12 | GS="true"
13 | echo "Expected $GS got $AT"
14 | [ "$AT" = $GS ]
15 | }
16 |
17 | @test "notapalindrome" {
18 | AT=$(./drkennetz.sh "notapalindrome")
19 | GS="false"
20 | echo "Expected $GS got $AT"
21 | [ "$AT" = $GS ]
22 | }
23 |
24 | @test "empty" {
25 | AT=$(./drkennetz.sh)
26 | GS="false"
27 | echo "Expected $GS got $AT"
28 | [ "$AT" = $GS ]
29 | }
30 |
31 |
--------------------------------------------------------------------------------
/challenges/2021-04-20-potential-palindrome/solutions/bash/drkennetz/drkennetz.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | input=$1
4 | output="false"
5 |
6 | # If no input then return
7 | if [ -z "$input" ]; then
8 | echo $output && exit 0
9 | fi
10 |
11 | oddcount=0
12 | for (( i=0; i <${#input}; i++ )); do
13 | # extracts the number of times char is present in string such as cc, aa, rr, e
14 | res="${input//[^${input:$i:1}]}"
15 | # ${#res} returns the count of the string after the extraction and then ensures that it is greater than or equal to 1 (if there is only 1 occurrence, division by 2 will equal 0, meaning it is an odd)
16 | if [ ! $((${#res} / 2)) -ge 1 ]; then
17 | ((oddcount++))
18 | fi
19 | done
20 |
21 | if [ "$oddcount" -gt 1 ]; then
22 | echo "false"
23 | else
24 | echo "true"
25 | fi
26 |
27 |
--------------------------------------------------------------------------------
/challenges/2021-04-20-potential-palindrome/solutions/cpp/juliocvaz/Makefile:
--------------------------------------------------------------------------------
1 | CXXFLAGS= -std=c++11
--------------------------------------------------------------------------------
/challenges/2021-04-20-potential-palindrome/solutions/cpp/juliocvaz/juliocvaz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-04-20-potential-palindrome/solutions/cpp/juliocvaz/juliocvaz
--------------------------------------------------------------------------------
/challenges/2021-04-20-potential-palindrome/solutions/cpp/juliocvaz/juliocvaz.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | const int NUM_OF_CHARS = 256;
4 |
5 | bool check_form_palindrome(std::string str)
6 | {
7 |
8 | int count[NUM_OF_CHARS] = { 0 };
9 | int odd = 0;
10 |
11 | for (int i = 0; str[i]; i++)
12 | count[str[i]]+= 1;
13 | for (int i = 0; i < NUM_OF_CHARS; i++) {
14 | // @memory address of the operand
15 | if (count[i] & 1) {
16 | odd++;
17 | }
18 |
19 | if (odd > 1) {
20 | return false;
21 | }
22 | }
23 |
24 | return true;
25 | }
26 |
27 | int main()
28 | {
29 | check_form_palindrome("carrace") ? std::cout << "Yes\n" : std::cout << "No\n";
30 | check_form_palindrome("asdfghjklkjhgfdsa") ? std::cout << "Yes\n" : std::cout << "No\n";
31 | check_form_palindrome("notapalindrome") ? std::cout << "Yes\n" : std::cout << "No\n";
32 | return 0;
33 | }
34 |
--------------------------------------------------------------------------------
/challenges/2021-04-20-potential-palindrome/solutions/githubusername.lang:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-04-20-potential-palindrome/solutions/githubusername.lang
--------------------------------------------------------------------------------
/challenges/2021-04-20-potential-palindrome/solutions/go/drkennetz/drkennetz_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "testing"
6 | )
7 |
8 | func TestCanMakePalindrome(t *testing.T) {
9 | tables := []struct {
10 | x interface{}
11 | y bool
12 | }{
13 | {"carrace", true},
14 | {"", false},
15 | {"annnab", false},
16 | {41231234, true},
17 | }
18 |
19 | for _, table := range tables {
20 | result := CanMakePalindrome(table.x)
21 | if result != table.y {
22 | t.Error("FAIL: CanMakePalindrome of: ", result, "was incorrect, got: ", result, "expected: ", table.y)
23 | } else {
24 | fmt.Println("SUCCESS: CanMakePalindrome of: ", result, "was correct, got: ", result, "expected: ", table.y)
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/challenges/2021-04-20-potential-palindrome/solutions/python/laurelin/laurelin.py:
--------------------------------------------------------------------------------
1 | from collections import defaultdict
2 |
3 |
4 | def can_make_palindrome(s: str) -> bool:
5 | #count char frequency in string, if more than one is odd, not a palindrome
6 | if not s:
7 | return False
8 | freq = defaultdict(int)
9 | for char in s:
10 | freq[char] += 1
11 | if len([val for val, chr in freq.items() if chr % 2 != 0]) > 1:
12 | return False
13 | return True
14 |
--------------------------------------------------------------------------------
/challenges/2021-04-20-potential-palindrome/solutions/python/laurelin/laurelin_test.py:
--------------------------------------------------------------------------------
1 | import laurelin
2 |
3 |
4 | def test1_palindrome():
5 | output = laurelin.can_make_palindrome("aaaaaa")
6 | assert output == True
7 |
8 |
9 | def test2_palindrome():
10 | output = laurelin.can_make_palindrome("aaaaa")
11 | assert output == True
12 |
13 |
14 | def test3_palindrome():
15 | output = laurelin.can_make_palindrome("aabb")
16 | assert output == True
17 |
18 |
19 | def test4_palindrome():
20 | output = laurelin.can_make_palindrome("aaabbb")
21 | assert output == False
22 |
23 | def test5_palindrome():
24 | output = laurelin.can_make_palindrome("carrace")
25 | assert output == True
26 |
27 | def test6_palindrome():
28 | output = laurelin.can_make_palindrome("asdfghjklkjhgfdsa")
29 | assert output == True
30 |
31 | def test7_palindrome():
32 | output = laurelin.can_make_palindrome("")
33 | assert output == False
--------------------------------------------------------------------------------
/challenges/2021-04-20-potential-palindrome/test.java:
--------------------------------------------------------------------------------
1 | src/test/java/io/codeconnector/codedojo/PotentialPalindromeTest.java
--------------------------------------------------------------------------------
/challenges/2021-04-27-sum-arrays/solutions/da-vinci-noob.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | def sum_array(array, new_array = [])
4 | array.each do |elem|
5 | if elem.is_a? Array
6 | sum_array(elem, new_array)
7 | else
8 | new_array << elem
9 | end
10 | end
11 | new_array.sum
12 | end
13 |
--------------------------------------------------------------------------------
/challenges/2021-04-27-sum-arrays/solutions/yourgituser.rb:
--------------------------------------------------------------------------------
1 | # after your tests pass, copy your method code here
2 |
3 | # def sum_arrays(array)
4 | # the rest of my awesome code
5 | # end
6 |
--------------------------------------------------------------------------------
/challenges/2021-04-27-sum-arrays/src/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source 'https://rubygems.org'
4 |
5 | gem 'rspec'
6 |
--------------------------------------------------------------------------------
/challenges/2021-04-27-sum-arrays/src/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | coderay (1.1.3)
5 | diff-lcs (1.4.4)
6 | method_source (1.0.0)
7 | pry (0.14.1)
8 | coderay (~> 1.1)
9 | method_source (~> 1.0)
10 | rspec (3.10.0)
11 | rspec-core (~> 3.10.0)
12 | rspec-expectations (~> 3.10.0)
13 | rspec-mocks (~> 3.10.0)
14 | rspec-core (3.10.1)
15 | rspec-support (~> 3.10.0)
16 | rspec-expectations (3.10.1)
17 | diff-lcs (>= 1.2.0, < 2.0)
18 | rspec-support (~> 3.10.0)
19 | rspec-mocks (3.10.2)
20 | diff-lcs (>= 1.2.0, < 2.0)
21 | rspec-support (~> 3.10.0)
22 | rspec-support (3.10.2)
23 |
24 | PLATFORMS
25 | ruby
26 |
27 | DEPENDENCIES
28 | pry
29 | rspec
30 |
31 | BUNDLED WITH
32 | 2.1.4
33 |
--------------------------------------------------------------------------------
/challenges/2021-04-27-sum-arrays/src/spec/test_array_spec.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | require './sum_arrays'
4 |
5 | RSpec.describe 'sum_arrays' do
6 | let(:return_value) { sum_array(array) }
7 |
8 | context 'given a one dimension array' do
9 | let(:array) { [1, 2, 3, 4, 5] }
10 |
11 | it 'returns 15' do
12 | expect(return_value).to eq(15)
13 | end
14 | end
15 |
16 | context 'given a two dimension array' do
17 | let(:array) { [1, 2, [1, 2, 3], 4, 5] }
18 |
19 | it 'returns 18' do
20 | expect(return_value).to eq(18)
21 | end
22 | end
23 |
24 | context 'given an n dimension array' do
25 | let(:array) { [1, [1, 2, [3, 4], 5], [6, 7]] }
26 |
27 | it 'returns 29' do
28 | expect(return_value).to eq(29)
29 | end
30 | end
31 | end
32 |
--------------------------------------------------------------------------------
/challenges/2021-04-27-sum-arrays/src/sum_arrays.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | def sum_array(array)
4 | # your code goes here
5 | end
6 |
--------------------------------------------------------------------------------
/challenges/2021-05-04-a-box-in-a-box/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "2021-05-04-a-box-in-a-box",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2021-05-04-a-box-in-a-box/solution.test.js:
--------------------------------------------------------------------------------
1 | const { Rectangle, rectanglesOverlap } = require('./solution');
2 |
3 | test('Two rectangles that do not overlap', () => {
4 | var rectangle1 = new Rectangle(1, 4, 3, 3);
5 | var rectangle2 = new Rectangle(0, 3, 2, 1);
6 | expect(rectanglesOverlap(rectangle1, rectangle2)).toBe(false);
7 | });
8 |
9 | test('Two rectangles that DO overlap', () => {
10 | var rectangle1 = new Rectangle(1, 4, 3, 3);
11 | var rectangle2 = new Rectangle(0, 3, 4, 4);
12 | expect(rectanglesOverlap(rectangle1, rectangle2)).toBe(true);
13 | });
14 |
15 | test('Two rectangles that partially overlap', () => {
16 | var rectangle1 = new Rectangle(1, 4, 3, 3);
17 | var rectangle2 = new Rectangle(0, 3, 3, 3);
18 | expect(rectanglesOverlap(rectangle1, rectangle2)).toBe(false);
19 | });
20 |
21 |
--------------------------------------------------------------------------------
/challenges/2021-05-04-a-box-in-a-box/solutions/go/birenderjit/birenderjit_test.go:
--------------------------------------------------------------------------------
1 | package rectangle
2 |
3 | import "testing"
4 |
5 | type rectangleTestcase struct {
6 | description string
7 | r1 rectangleData
8 | r2 rectangleData
9 | ok bool
10 | }
11 |
12 | var testCases = []rectangleTestcase{
13 | {
14 | description: "Two rectangles that do not overlap",
15 | r1: rectangleData{1, 4, 3, 3},
16 | r2: rectangleData{0, 3, 2, 1},
17 | ok: false,
18 | },
19 | {
20 | description: "Two rectangles that DO overlap",
21 | r1: rectangleData{1, 4, 3, 3},
22 | r2: rectangleData{0, 3, 4, 4},
23 | ok: true,
24 | },
25 | {
26 | description: "Two rectangles that partially overlap",
27 | r1: rectangleData{1, 4, 3, 3},
28 | r2: rectangleData{0, 3, 3, 3},
29 | ok: false,
30 | },
31 |
32 | }
33 |
34 | func TestOverlaps(t *testing.T) {
35 | for _, test := range testCases {
36 | r1 := CreateRectangle(test.r1)
37 | r2 := CreateRectangle(test.r2)
38 | if res := Overlaps(r1, r2); res != test.ok {
39 | t.Error("FAIL: ", test.description, " Got: ", res, " Expected: ", test.ok)
40 | } else {
41 | t.Log("SUCCESS: ", test.description)
42 | }
43 | }
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/challenges/2021-05-04-a-box-in-a-box/solutions/go/birenderjit/go.mod:
--------------------------------------------------------------------------------
1 | module rectangle
2 |
3 | go 1.16
4 |
--------------------------------------------------------------------------------
/challenges/2021-05-04-a-box-in-a-box/solutions/go/drkennetz/drkennetz.go:
--------------------------------------------------------------------------------
1 | package solutions
2 |
3 | type coords [4]int
4 | type Rectangle struct {
5 | leftEdge int
6 | rightEdge int
7 | topEdge int
8 | bottomEdge int
9 | }
10 |
11 | func (R Rectangle) Construct(c coords) Rectangle {
12 | R.leftEdge = c[0]
13 | R.rightEdge = c[0] + c[2]
14 | R.topEdge = c[1]
15 | R.bottomEdge = c[1] + c[3]
16 | return R
17 | }
18 |
19 | func (R Rectangle) overlaps(r Rectangle) bool {
20 | return R.leftEdge <= r.leftEdge &&
21 | R.rightEdge >= r.rightEdge &&
22 | R.bottomEdge >= r.bottomEdge &&
23 | R.topEdge <= r.bottomEdge
24 | }
25 |
26 | // Overlaps compares to rectangles to see if they overlap
27 | func Overlaps(r1, r2 Rectangle) bool {
28 | return r1.overlaps(r2) || r2.overlaps(r1)
29 | }
30 |
--------------------------------------------------------------------------------
/challenges/2021-05-04-a-box-in-a-box/solutions/go/drkennetz/drkennetz_test.go:
--------------------------------------------------------------------------------
1 | package solutions
2 |
3 | import (
4 | "testing"
5 | "fmt"
6 | )
7 |
8 | func TestOverlaps(t *testing.T) {
9 | tables := []struct {
10 | c1 coords
11 | c2 coords
12 | s bool
13 | }{
14 | {coords{1, 4, 3, 3}, coords{0, 3, 2, 1}, false},
15 | {coords{1, 4, 3, 3}, coords{0, 3, 4, 4}, true},
16 | {coords{1, 4, 3, 3}, coords{0, 3, 3, 3}, false},
17 | }
18 | for _, x := range tables {
19 | r1 := Rectangle{}.Construct(x.c1)
20 | r2 := Rectangle{}.Construct(x.c2)
21 | result := Overlaps(r1, r2)
22 | if result != x.s {
23 | t.Error("FAIL: Overlaps of: ", r1, r2, "was incorrect, got: ", result, "expected: ", x.s)
24 | } else {
25 | fmt.Println("SUCCESS: Overlaps of: ", r1, r2, "was correct!")
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/challenges/2021-05-04-a-box-in-a-box/solutions/go/drkennetz/go.mod:
--------------------------------------------------------------------------------
1 | module solutions
2 |
3 | go 1.15
4 |
--------------------------------------------------------------------------------
/challenges/2021-05-04-a-box-in-a-box/solutions/rust/oktak/README.md:
--------------------------------------------------------------------------------
1 | # Run the test cases by rustc
2 |
3 |
4 | ```
5 | # Compile
6 | rustc --test oktak.rs
7 |
8 | # Run the test cases
9 | ./oktak
10 |
11 | ```
12 |
13 | ## Tested environment
14 |
15 | - rustc 1.52.1
16 | - Ubuntu 18.04
17 |
--------------------------------------------------------------------------------
/challenges/2021-05-04-a-box-in-a-box/solutions/yourgithubusername.lang:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-05-04-a-box-in-a-box/solutions/yourgithubusername.lang
--------------------------------------------------------------------------------
/challenges/2021-05-11-nonconstructible-change/solutions/JavaScript/mrumiker/mrumiker.js:
--------------------------------------------------------------------------------
1 | function minImpossibleCoins(arr) {
2 |
3 | let sum = 1;
4 |
5 | for (let num of arr) {
6 | if (num > sum) return sum;
7 | sum += num;
8 | }
9 |
10 | return sum;
11 |
12 | }
13 |
14 | console.log(minImpossibleCoins([1]));//2
15 | console.log(minImpossibleCoins([1, 1, 1, 1, 1]));//6
16 | console.log(minImpossibleCoins([1, 1, 2, 3, 5, 7, 22]));//20
17 | console.log(minImpossibleCoins([1, 1, 4, 5, 6, 7, 9]));//3
18 | console.log(minImpossibleCoins([1, 1, 1, 1, 5, 10, 15, 20, 100]));//55
19 |
--------------------------------------------------------------------------------
/challenges/2021-05-11-nonconstructible-change/solutions/python/non_constructible_change.py:
--------------------------------------------------------------------------------
1 | def min_impossible_coins(coins):
2 | # checks to see if all the coins are the same
3 | same_coins = all(x == coins[0] for x in coins)
4 |
5 | # if len is 1 and coin is equal to 1
6 | if len(coins) == 1 and coins[0] == 1:
7 | return coins[0] + 1
8 |
9 | # if all coins are the same sum them + 1
10 | elif same_coins:
11 | same_coins_sum = sum(coins)
12 | return same_coins_sum + 1
13 |
14 | # else do this
15 | else:
16 | running_total = 1
17 | for cur, nxt in zip(coins, coins[1:]):
18 | running_total += cur
19 | if running_total == nxt - 1:
20 | # print(running_total)
21 | break
22 | return running_total
23 |
--------------------------------------------------------------------------------
/challenges/2021-05-11-nonconstructible-change/solutions/python/non_constructible_change_test.py:
--------------------------------------------------------------------------------
1 | import unittest
2 |
3 | from non_constructible_change import min_impossible_coins
4 |
5 |
6 | class MyTestCase(unittest.TestCase):
7 |
8 | def test_one(self):
9 | coins = [1]
10 | expected = 2
11 | assert min_impossible_coins(coins) == expected
12 |
13 | def test_two(self):
14 | coins = [1, 1, 1, 1, 1]
15 | expected = 6
16 | assert min_impossible_coins(coins) == expected
17 |
18 | def test_three(self):
19 | coins = [1, 1, 2, 3, 5, 7, 22]
20 | expected = 20
21 | assert min_impossible_coins(coins) == expected
22 |
23 | def test_four(self):
24 | coins = [1, 1, 4, 5, 6, 8, 9]
25 | expected = 3
26 | assert min_impossible_coins(coins) == expected
27 |
28 | def test_five(self):
29 | coins = [1, 1, 1, 1, 5, 10, 15, 20, 100]
30 | expected = 55
31 | assert min_impossible_coins(coins) == expected
32 |
33 |
34 | if __name__ == '__main__':
35 | unittest.main()
36 |
--------------------------------------------------------------------------------
/challenges/2021-05-11-nonconstructible-change/test-it.sh:
--------------------------------------------------------------------------------
1 | ../../resources/java/java-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2021-05-18-sum-of-squares/challenge.md:
--------------------------------------------------------------------------------
1 | # Sum of Squares
2 |
3 | Given a positive integer `n`, find the smallest number of squared integers which sum to `n` (i.e. n = x2 + y2 should yield `2`).
4 |
5 | ## Business Rules/Errata
6 |
7 | - Any attempt to provide non-integer, non-positive input should return an error.
8 | - Return only the count of squared integers that sum to `n`, not the list of integers.
9 | - Remember that 12 = 1.
10 |
11 | ## Examples
12 |
13 | ```bash
14 | SumOfSquares(13); // 2
15 | SumOfSquares(27); // 3
16 | ```
17 |
18 | - For `n` = 13: 32 + 22 = 9 + 4 = 13
19 | - For `n` = 27:
20 | - 32 + 32 + 32 = 9 + 9 + 9 = 27
21 | - 52 + 12 + 12 = 25 + 1 + 1 = 27
22 |
23 | ## Tackling This Challenge
24 |
25 | 1. The challenge will be live-coded in our weekly Tuesday meetup in the `solutions.go` file.
26 | 2. During the live-coding session, it will be tested by navigating to this directory and running `go test`.
27 | 3. The results of the live coding demo will be PR'ed as a mob solution. Any future submitters should reference [this solutions guide in our wiki](https://github.com/codeconnector/CodingDojo/wiki#solutions).
28 |
29 | ## Requirements
30 |
31 | - Installed go
32 |
--------------------------------------------------------------------------------
/challenges/2021-05-18-sum-of-squares/go.mod:
--------------------------------------------------------------------------------
1 | module solution
2 |
3 | go 1.15
4 |
--------------------------------------------------------------------------------
/challenges/2021-05-18-sum-of-squares/solution.go:
--------------------------------------------------------------------------------
1 | package solution
2 |
3 | /*
4 | # Sum of Squares
5 | Given a positive integer `n`, find the smallest number of squared integers which sum to `n` (i.e. n = x^2 + y^2 should yield `2`).
6 |
7 | ## Business Rules/Errata
8 |
9 | - Any attempt to provide non-integer, non-positive input should return an error.
10 | - Return only the count of squared integers that sum to `n`, not the list of integers.
11 | - Remember that 1^2 = 1.
12 |
13 | ## Examples
14 |
15 | ```bash
16 | SumOfSquares(13); // 2
17 | SumOfSquares(27); // 3
18 | ```
19 |
20 | - For `n` = 13: 3^2 + 2^2 = 9 + 4 = 13
21 | - For `n` = 27:
22 | - 3^2 + 3^2 + 3^2 = 9 + 9 + 9 = 27
23 | - 5^2 + 1^2 + 1^2 = 25 + 1 + 1 = 27
24 | */
25 |
26 |
27 | func SumOfSquares(i int) int {
28 | // Your code goes here
29 | return 1
30 | }
31 |
--------------------------------------------------------------------------------
/challenges/2021-05-18-sum-of-squares/solution_test.go:
--------------------------------------------------------------------------------
1 | package solution
2 |
3 | import (
4 | "fmt"
5 | "testing"
6 | )
7 |
8 | func TestSumOfSquares(t *testing.T) {
9 | tables := []struct {
10 | input int
11 | result int
12 | }{
13 | {13, 2},
14 | {27, 3},
15 | {144, 1},
16 | {84, 3},
17 | {85, 2},
18 | }
19 | for _, x := range tables {
20 | soln := SumOfSquares(x.input)
21 | if soln != x.result {
22 | t.Error("FAIL: SumOfSquares of: ", x.input, "was incorrect, got: ", soln, "expected: ", x.result)
23 | } else {
24 | fmt.Println("SUCCESS: SumOfSquares of: ", x.input, "yielded: ", soln, "which was correct!")
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/challenges/2021-05-18-sum-of-squares/solutions/Python/mrumiker.py:
--------------------------------------------------------------------------------
1 | import math
2 |
3 | def count_squared_addends_max_four(input_int):
4 | """
5 | Due to Lagrange's four square theorem all numbers are representable as the sum of at most 4 squares
6 | https://en.wikipedia.org/wiki/Lagrange%27s_four-square_theorem
7 |
8 | Solution by Corey McCarty
9 | Additional input by Charles Umiker
10 | """
11 | upper_limit = math.floor(math.sqrt(input_int))
12 | if input_int == upper_limit ** 2:
13 | return 1 # 1 is the answer if and only if input_int is a perfect square
14 | options = [v for v in range(1, upper_limit + 1)]
15 | options.sort(reverse=True)
16 | i = 0
17 | answer_is_3 = False
18 | while i <= len(options) - 1:
19 | i_square = options[i] ** 2
20 | j = i
21 | while (j <= len(options) - 1):
22 | j_square = options[j] ** 2
23 | if input_int == i_square + j_square:
24 | return 2 # Quitting early as there can't be a better solution at this point
25 | k = j
26 | while k <= len(options) - 1:
27 | k_square = options[k] ** 2
28 | if input_int == i_square + j_square + k_square:
29 | answer_is_3 = True
30 | k += 1
31 | j += 1
32 | i += 1
33 |
34 | if answer_is_3:
35 |
36 | return 3
37 |
38 | return 4
39 |
40 |
--------------------------------------------------------------------------------
/challenges/2021-05-18-sum-of-squares/solutions/R/ericwburden/ericwburden.R:
--------------------------------------------------------------------------------
1 | library(testthat)
2 |
3 | sum_of_squares <- function(n) {
4 | upper_limit <- floor(sqrt(n))
5 | possible_addends <- (1:upper_limit)^2
6 |
7 | can_sum_in_steps <- function(n, steps) {
8 | if (steps == 0) return(FALSE)
9 | if (any(possible_addends == n)) return(TRUE)
10 |
11 | for (addend in possible_addends) {
12 | if (addend > n) next
13 | if (can_sum_in_steps(n - addend, steps - 1)) return(TRUE)
14 | }
15 | FALSE
16 | }
17 |
18 | for (steps in 1:upper_limit) {
19 | if (can_sum_in_steps(n, steps)) return(steps)
20 | }
21 | n
22 | }
23 |
24 |
25 | test_that("Can find the smallest number of squares that sum to n", {
26 | expect_equal(sum_of_squares(13), 2)
27 | expect_equal(sum_of_squares(27), 3)
28 | expect_equal(sum_of_squares(144), 1)
29 | expect_equal(sum_of_squares(84), 3)
30 | expect_equal(sum_of_squares(85), 2)
31 | })
32 |
--------------------------------------------------------------------------------
/challenges/2021-05-18-sum-of-squares/solutions/go/drkennetz/go.mod:
--------------------------------------------------------------------------------
1 | module solution
2 |
3 | go 1.15
4 |
--------------------------------------------------------------------------------
/challenges/2021-05-18-sum-of-squares/solutions/go/drkennetz/solution_test.go:
--------------------------------------------------------------------------------
1 | package solution
2 |
3 | import (
4 | "fmt"
5 | "testing"
6 | )
7 |
8 | func TestSumOfSquares(t *testing.T) {
9 | tables := []struct {
10 | input int
11 | result int
12 | }{
13 | {13, 2},
14 | {27, 3},
15 | {144, 1},
16 | {84, 3},
17 | {85, 2},
18 | }
19 | for _, x := range tables {
20 | soln := SumOfSquares(x.input)
21 | if soln != x.result {
22 | t.Error("FAIL: SumOfSquares of: ", x.input, "was incorrect, got: ", soln, "expected: ", x.result)
23 | } else {
24 | fmt.Println("SUCCESS: SumOfSquares of: ", x.input, "yielded: ", soln, "which was correct!")
25 | }
26 | }
27 | }
28 |
29 | func benchmarkSumOfSquares(i int, b *testing.B) {
30 | for n:=0; n < b.N; n++ {
31 | SumOfSquares(i)
32 | }
33 | }
34 |
35 | func BenchmarkSumOfSquares13(b *testing.B) { benchmarkSumOfSquares(13, b) }
36 | func BenchmarkSumOfSquares27(b *testing.B) { benchmarkSumOfSquares(27, b) }
37 | func BenchmarkSumOfSquares144(b *testing.B) { benchmarkSumOfSquares(144, b) }
38 | func BenchmarkSumOfSquares84(b *testing.B) { benchmarkSumOfSquares(84, b) }
39 | func BenchmarkSumOfSquares85(b *testing.B) { benchmarkSumOfSquares(85, b) }
40 |
--------------------------------------------------------------------------------
/challenges/2021-05-18-sum-of-squares/solutions/rust/ericwburden/ericwburden.rs:
--------------------------------------------------------------------------------
1 | pub fn can_sum_in_steps(total: usize, steps: usize, addends: &[usize]) -> bool {
2 | if steps == 0 { return false; }
3 | if addends.contains(&total) { return true; }
4 |
5 | for addend in addends {
6 | if addend > &total { continue; }
7 | if can_sum_in_steps(total - addend, steps - 1, addends) { return true; }
8 | }
9 | false
10 | }
11 |
12 | pub fn sum_of_squares(n: usize) -> usize {
13 | let upper_limit = (n as f64).sqrt() as usize;
14 | let possible_addends: Vec<_> = (1..=upper_limit).map(|x| x*x).collect();
15 |
16 | for step in 1..=upper_limit {
17 | if can_sum_in_steps(n, step, &possible_addends) { return step; }
18 | }
19 |
20 | n
21 | }
22 |
23 | #[cfg(test)]
24 | mod tests {
25 | use super::*;
26 |
27 | const TEST_CASES: [(usize, usize); 5] = [
28 | (13, 2),
29 | (27, 3),
30 | (144, 1),
31 | (84, 3),
32 | (85, 2)
33 | ];
34 |
35 | #[test]
36 | fn it_works() {
37 | for case in &TEST_CASES {
38 | assert_eq!(sum_of_squares(case.0), case.1);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/challenges/2021-05-25-dictionary-decompression/challenge.md:
--------------------------------------------------------------------------------
1 | # Dictionary Decompression
2 |
3 | Given a nested dictionary, flatten the dictionary such that the keys of the final result are namespaced with a period between the original keys leading to the value.
4 |
5 | ## Business Rules/Errata
6 |
7 | - ***Data Structure Required: Dictionary/Map/HashMap*** This challenge requires a language that supports a version of a Dictionary.
8 | - Your function should be able to flatten dictionaries nested arbitrarily deeply.
9 | - You can assume that none of the dictionary keys contain a period.
10 | - The type of the dictionary values is not important to this exercise. Assume they will always be unsigned integers.
11 |
12 | ## Example
13 |
14 | ```
15 | nested_dict = {
16 | "key": 3,
17 | "foo": {
18 | "a": 5,
19 | "bar": {
20 | "baz": 8
21 | }
22 | }
23 | }
24 |
25 | result = flattenDictionary(nested_dict)
26 | print(result)
27 |
28 | {
29 | "key": 3,
30 | "foo.a": 5,
31 | "foo.bar.baz": 8
32 | }
33 | ```
34 |
--------------------------------------------------------------------------------
/challenges/2021-06-01-find-three-largest-numbers/run-tests.sh:
--------------------------------------------------------------------------------
1 | ../../resources/java/java-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2021-06-01-find-three-largest-numbers/solutions/JavaScript/mrumiker/mrumiker.js:
--------------------------------------------------------------------------------
1 | function findThreeLargestNumbers(arr) {
2 | if (arr.length < 3) return null;
3 | let ans = arr.slice(0, 3),
4 | min = Math.min(...ans);
5 | for (let i = 3; i < arr.length; i++) {
6 | if (arr[i] > min) {
7 | ans[ans.indexOf(min)] = arr[i];
8 | min = Math.min(...ans);
9 | }
10 | }
11 | return ans.sort((a, b) => a - b);
12 | }
13 |
--------------------------------------------------------------------------------
/challenges/2021-06-01-find-three-largest-numbers/solutions/go/drkennetz/drkennetz_test.go:
--------------------------------------------------------------------------------
1 | package solution
2 |
3 | import (
4 | "fmt"
5 | "reflect"
6 | "testing"
7 | )
8 |
9 | func TestFindThreeLargest(t *testing.T) {
10 | tables := []struct {
11 | input []int
12 | result []int
13 | }{
14 | {[]int{141, 2, 17, -7, -17, -27, 18, 541, 8, 7, 7}, []int{18, 141, 541}},
15 | {[]int{11, -7, 5, -7}, []int{-7, 5, 11}},
16 | {[]int{1}, nil},
17 | }
18 |
19 | for _, table := range(tables) {
20 | actual := FindThreeLargest(table.input)
21 | if !reflect.DeepEqual(actual, table.result){
22 | fmt.Println("FAIL, expected: ", table.result, "got: ", actual)
23 | } else {
24 | fmt.Println("SUCCESS!")
25 | }
26 | }
27 | }
28 |
29 | func BenchmarkFindThreeLargest(b *testing.B) {
30 | for n := 0; n < b.N; n++ {
31 | FindThreeLargest([]int{141, 2, 17, -7, -17, -27, 18, 541, 8, 7, 7})
32 | }
33 | }
--------------------------------------------------------------------------------
/challenges/2021-06-01-find-three-largest-numbers/solutions/go/drkennetz/go.mod:
--------------------------------------------------------------------------------
1 | module solution
2 |
3 | go 1.15
4 |
--------------------------------------------------------------------------------
/challenges/2021-06-08-simple-2d-iterator/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "2021-06-08-simple-2d-iterator",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2021-06-08-simple-2d-iterator/run-tests.sh:
--------------------------------------------------------------------------------
1 | ../../resources/javascript/javascript-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2021-06-08-simple-2d-iterator/solution.js:
--------------------------------------------------------------------------------
1 | // # Simple 2D Iterator
2 | //
3 | // Implement a class (or struct, or object) representing a 2-dimensional iterator.
4 | // This class should be initialized with a 2-dimensional (nested) array, and should
5 | // implement two methods:
6 | //
7 | // - `next()` returns the next element in the array of arrays
8 | // - `has_next()` returns true/false indicating whether the iterator still has elements
9 | // left
10 | //
11 | // ## Business Rules/Errata
12 | //
13 | // - ***Data Structure Required: 2D Array***
14 | // - Your class will need a constructor method (or other strategy) to accept a
15 | // 2-dimensional array and produce an instance of your class.
16 | // - You should not `flatten` or otherwise copy data out of the 2D array into another
17 | // data structure.
18 | // - If you call `next()` on your class, and there are no elements left to return,
19 | // return `null` (or some other indicator that the iterator has been exhausted).
20 |
21 | class NestedIterator {
22 | constructor(array) {
23 | // `array` should be a two-dimensional array
24 | this.array = array;
25 | }
26 |
27 | next() {
28 | // Insert solution code here
29 | }
30 |
31 | has_next() {
32 | // Insert solution code here
33 | }
34 | }
35 |
36 | module.exports = NestedIterator;
37 |
--------------------------------------------------------------------------------
/challenges/2021-06-08-simple-2d-iterator/solution.test.js:
--------------------------------------------------------------------------------
1 | const NestedIterator = require('./solution');
2 |
3 | test('Can iterate through example nested array', () => {
4 | var nestedIterator = new NestedIterator([[9], [1, 7, 5], [2, 9], []]);
5 | expect(nestedIterator.next()).toBe(9);
6 | expect(nestedIterator.next()).toBe(1);
7 | expect(nestedIterator.next()).toBe(7);
8 | expect(nestedIterator.next()).toBe(5);
9 | expect(nestedIterator.next()).toBe(2);
10 | expect(nestedIterator.next()).toBe(9);
11 | expect(nestedIterator.next()).toBe(null);
12 | })
13 |
14 | test('Correctly indicates when the iterator has a next element', () => {
15 | var nestedIterator = new NestedIterator([[9], [1, 7, 5], [2, 9], []]);
16 | nestedIterator.next(); // 9
17 | expect(nestedIterator.has_next()).toBe(true);
18 | nestedIterator.next(); // 1
19 | nestedIterator.next(); // 7
20 | nestedIterator.next(); // 5
21 | expect(nestedIterator.has_next()).toBe(true);
22 | nestedIterator.next(); // 2
23 | expect(nestedIterator.has_next()).toBe(true);
24 | nestedIterator.next(); //9
25 | expect(nestedIterator.has_next()).toBe(false);
26 | })
27 |
--------------------------------------------------------------------------------
/challenges/2021-06-08-simple-2d-iterator/solutions/java/codingis4noobs2/Codingis4noobs2.java:
--------------------------------------------------------------------------------
1 | // 2D Array Itreator
2 |
3 | import java.util.Iterator;
4 | import java.util.NoSuchElementException;
5 |
6 | class NestedIterator implements Iterator {
7 | private T[][] array;
8 | private int row;
9 | private int col;
10 |
11 | public NestedIterator(T[][] array) {
12 | this.array = array;
13 | row = 0;
14 | col = 0;
15 | }
16 |
17 | public boolean hasNext() {
18 | return row < array.length && col < array[row].length;
19 | }
20 |
21 | public T next() {
22 | if (!hasNext()) {
23 | throw new NoSuchElementException();
24 | }
25 | T result = array[row][col];
26 | col++;
27 | if (col == array[row].length) {
28 | row++;
29 | col = 0;
30 | }
31 | return result;
32 | }
33 | }
34 |
35 | public class Codingis4noobs2 {
36 | public static void main(String[] args) {
37 | Integer[][] array = new Integer[][] {
38 | { 1, 2, 3 },
39 | { 4, 5, 6 },
40 | { 7, 8, 9 }
41 | };
42 | NestedIterator iterator = new NestedIterator(array);
43 | while (iterator.hasNext()) {
44 | System.out.println(iterator.next());
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/challenges/2021-06-15-square-maze/solutions/ruby/yourgituser.rb:
--------------------------------------------------------------------------------
1 | # after your tests pass, copy your code here
2 |
3 | # def square_maze(array)
4 | # the rest of my awesome code
5 | # end
6 |
--------------------------------------------------------------------------------
/challenges/2021-06-15-square-maze/src/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source 'https://rubygems.org'
4 |
5 | gem 'rspec'
6 | gem 'pry'
7 |
--------------------------------------------------------------------------------
/challenges/2021-06-15-square-maze/src/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | coderay (1.1.3)
5 | diff-lcs (1.4.4)
6 | method_source (1.0.0)
7 | pry (0.14.1)
8 | coderay (~> 1.1)
9 | method_source (~> 1.0)
10 | rspec (3.10.0)
11 | rspec-core (~> 3.10.0)
12 | rspec-expectations (~> 3.10.0)
13 | rspec-mocks (~> 3.10.0)
14 | rspec-core (3.10.1)
15 | rspec-support (~> 3.10.0)
16 | rspec-expectations (3.10.1)
17 | diff-lcs (>= 1.2.0, < 2.0)
18 | rspec-support (~> 3.10.0)
19 | rspec-mocks (3.10.2)
20 | diff-lcs (>= 1.2.0, < 2.0)
21 | rspec-support (~> 3.10.0)
22 | rspec-support (3.10.2)
23 |
24 | PLATFORMS
25 | ruby
26 |
27 | DEPENDENCIES
28 | pry
29 | rspec
30 |
31 | BUNDLED WITH
32 | 2.1.4
33 |
--------------------------------------------------------------------------------
/challenges/2021-06-15-square-maze/src/mob.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | def count_paths(array)
4 | # your code here
5 | # feel free to add any other methods you need
6 | end
7 |
--------------------------------------------------------------------------------
/challenges/2021-06-29-run-of-ones/solutions/java/mob/mob.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-06-29-run-of-ones/solutions/java/mob/mob.java
--------------------------------------------------------------------------------
/challenges/2021-06-29-run-of-ones/solutions/javascript/mrumiker.js:
--------------------------------------------------------------------------------
1 | function longest_binary_run(n) {
2 | const str = n.toString(2);
3 | let count = maxCount = 0;
4 | for (let i = 0; i < str.length; i++) {
5 | if (str[i] === '1') {
6 | count++;
7 | } else {
8 | count = 0;
9 | }
10 | if (count > maxCount) {
11 | maxCount = count;
12 | }
13 | }
14 | return maxCount;
15 | }
16 |
17 | console.log(longest_binary_run(156)); // 3
18 | console.log(longest_binary_run(1979)); // 4
19 | console.log(longest_binary_run(2731)); // 2
20 | console.log(longest_binary_run(2185)); // 1
21 |
--------------------------------------------------------------------------------
/challenges/2021-07-13-coin-counter/build.gradle.kts:
--------------------------------------------------------------------------------
1 | ../../resources/kotlin/build.gradle.kts
--------------------------------------------------------------------------------
/challenges/2021-07-13-coin-counter/gradlew:
--------------------------------------------------------------------------------
1 | ../../resources/kotlin/gradlew
--------------------------------------------------------------------------------
/challenges/2021-07-13-coin-counter/run_tests:
--------------------------------------------------------------------------------
1 | ../../resources/kotlin/run_tests.sh
--------------------------------------------------------------------------------
/challenges/2021-07-13-coin-counter/solutions/kotlin/hasancbngl/mob.kt:
--------------------------------------------------------------------------------
1 | fun coinCounter(coins: Int): Int {
2 | var numberOfRounds = 0
3 | var newNumberCoins: Double = coins.toDouble()
4 | while (true) {
5 | newNumberCoins = newNumberCoins / 2
6 | numberOfRounds++
7 | if (newNumberCoins <= 1) {
8 | print(numberOfRounds)
9 | return numberOfRounds
10 | }
11 | }
12 | return 0
13 | }
--------------------------------------------------------------------------------
/challenges/2021-07-13-coin-counter/src/main/kotlin/Solution.kt:
--------------------------------------------------------------------------------
1 | fun countCoinRounds(coins: Int): Int {
2 | // Insert code here to solve the challenge
3 | return 0
4 | }
5 |
--------------------------------------------------------------------------------
/challenges/2021-07-13-coin-counter/src/test/kotlin/SolutionTest.kt:
--------------------------------------------------------------------------------
1 | import org.junit.Test
2 | import kotlin.test.assertEquals
3 |
4 | class SolutionTest {
5 |
6 | @Test
7 | fun test2Coins() {
8 | assertEquals(1, countCoinRounds(2))
9 | }
10 |
11 | @Test
12 | fun test16Coins() {
13 | assertEquals(4, countCoinRounds(16))
14 | }
15 |
16 | @Test
17 | fun test128Coins() {
18 | assertEquals(7, countCoinRounds(128))
19 | }
20 |
21 | @Test
22 | fun test100Coins() {
23 | assertEquals(7, countCoinRounds(100))
24 | }
25 |
26 | @Test
27 | fun test10000Coins() {
28 | assertEquals(14, countCoinRounds(10000))
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/challenges/2021-07-20-balanced-brackets/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2021-07-20-balanced-brackets/run-tests.sh:
--------------------------------------------------------------------------------
1 | ../../resources/javascript/js-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2021-07-20-balanced-brackets/solution.js:
--------------------------------------------------------------------------------
1 | // # Balanced Brackets
2 | //
3 | // Given a string of round, curly, and square open and closing brackets, return
4 | // whether the brackets are balanced (well-formed).
5 | //
6 | // For example, given the string "([])[]({})", you should return true.
7 | // Given the string "([)]" or "((()", you should return false.
8 | //
9 | // ## Business Rules/Errata
10 | //
11 | // - The only characters considered to be 'brackets' are `(`, `)`, `[`, `]`, `{`,
12 | // and `}`.
13 | // - Your input will always be a string.
14 | // - An empty string is considered balanced (return true).
15 | // - **Your string may contain characters that are not brackets.**
16 | //
17 | // ## Examples
18 | //
19 | // ```
20 | // balanced_brackets("[[]]({}[])"); // true
21 | // balanced_brackets("[[({}[])"); // false
22 | // balanced_brackets(""); // true
23 | // balanced_brackets("(5 * 3) + 4"); // true
24 | // ```
25 |
26 | function balancedBrackets(input) {
27 | // Insert your solution code here
28 | }
29 |
30 | module.exports = balancedBrackets;
31 |
--------------------------------------------------------------------------------
/challenges/2021-07-20-balanced-brackets/solution.test.js:
--------------------------------------------------------------------------------
1 | const balancedBrackets = require('./solution');
2 |
3 | test('Can identify a balanced string', () => {
4 | expect(balancedBrackets("[[]]({}[])")).toBe(true);
5 | })
6 |
7 | test('Can identify an unbalanced string', () => {
8 | expect(balancedBrackets("[[({}[])")).toBe(false);
9 | })
10 |
11 | test('Can correctly handle empty strings as input', () => {
12 | expect(balancedBrackets("")).toBe(true);
13 | })
14 |
15 | test('Ignores non-brackets', () => {
16 | expect(balancedBrackets("(5 * 3) + [10 / {2}]")).toBe(true);
17 | })
18 |
19 | test('Handles sequences of single bracket types', () => {
20 | expect(balancedBrackets(")]})]}")).toBe(false);
21 | expect(balancedBrackets("([{(((")).toBe(false);
22 | })
23 |
24 | test('Handles strings with characters but no brackets', () => {
25 | expect(balancedBrackets("no brackets at all")).toBe(true);
26 | })
27 |
28 | test('Handles strings containing special characters', () => {
29 | expect(balancedBrackets(">>> (<> are not brackets) >>>")).toBe(true);
30 | expect(balancedBrackets("[///\\|||]")).toBe(true);
31 | expect(balancedBrackets("!@#$%%^&*(;',.<>?/\|~`'")).toBe(false);
32 | })
33 |
34 | test('Can handle brackets "balanced" the wrong way', () => {
35 | expect(balancedBrackets(")}][{(")).toBe(false);
36 | })
37 |
38 |
--------------------------------------------------------------------------------
/challenges/2021-07-20-balanced-brackets/solutions/javascript/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-07-20-balanced-brackets/solutions/javascript/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2021-07-20-balanced-brackets/solutions/javascript/mrumiker.js:
--------------------------------------------------------------------------------
1 | function balancedBrackets(str) {
2 | let testArr = [];
3 | for (let i = 0; i < str.length; i++) { //loop through each char in the string
4 | if (Object.values(matcher).includes(str[i])) {
5 | testArr.push(str[i]); //if the char is any kind of open bracket, add it to the end of testArr.
6 | } else if (Object.keys(matcher).includes(str[i]) &&
7 | testArr.pop() !== (matcher[str[i]])) {
8 | return false; //if the char is any kind of closed bracket, pop off the last item in testArr and check if it is the corresponding open bracket. If not, return false. Otherwise, continue.
9 | }
10 | //if the char is not a bracket, do nothing!
11 | }
12 | return !testArr.length; //if you have made it through the entire string without returning false, check to see if testArr is empty. If so, return true. Return false if there are unmatched brackets remaining.
13 | }
14 |
15 | const matcher = { //the matcher object holds the corresponding pairs of brackets as keys and values
16 | ')': '(',
17 | ']': '[',
18 | '}': '{',
19 | }
20 |
--------------------------------------------------------------------------------
/challenges/2021-07-20-balanced-brackets/solutions/python/laurelin/laurelin.py:
--------------------------------------------------------------------------------
1 | def balanced_brackets(input: str) -> bool:
2 | if len(input) == 0:
3 | return True
4 |
5 | stack = []
6 | brackets = {'(', ')', '[', ']', '{', '}'}
7 | bracket_pair = {')': '(', ']': '[', '}': '{'}
8 |
9 | for char in input:
10 | if char not in brackets:
11 | continue
12 |
13 | is_closed = char in bracket_pair
14 | size = len(stack)
15 |
16 | if size == 0 and is_closed: # if there are no opening brackets, but we found a closing bracket
17 | return False
18 |
19 | if not is_closed:
20 | stack.append(char)
21 | else:
22 | bracket = stack.pop()
23 | if bracket_pair[char] != bracket:
24 | return False
25 |
26 | size = len(stack)
27 | if size == 0:
28 | return True
29 | else:
30 | return False
31 |
--------------------------------------------------------------------------------
/challenges/2021-07-20-balanced-brackets/solutions/python/laurelin/laurelin_test.py:
--------------------------------------------------------------------------------
1 | import laurelin
2 |
3 |
4 | def test_1_brackets():
5 | output = laurelin.balanced_brackets("[[]]({}[])")
6 | assert output == True
7 |
8 |
9 | def test_2_brackets():
10 | output = laurelin.balanced_brackets("[[({}[])")
11 | assert output == False
12 |
13 |
14 | def test_3_brackets():
15 | output = laurelin.balanced_brackets("")
16 | assert output == True
17 |
18 |
19 | def test_4_brackets():
20 | output = laurelin.balanced_brackets("(5 * 3) + [10 / {2}]")
21 | assert output == True
22 |
23 |
24 | def test_5_brackets():
25 | output = laurelin.balanced_brackets(")]})]}")
26 | assert output == False
27 |
28 |
29 | def test_6_brackets():
30 | output = laurelin.balanced_brackets("([{(((")
31 | assert output == False
32 |
33 |
34 | def test_7_brackets():
35 | output = laurelin.balanced_brackets("no brackets at all")
36 | assert output == True
37 |
38 |
39 | def test_8_brackets():
40 | output = laurelin.balanced_brackets(">>> (<> are not brackets) >>>")
41 | assert output == True
42 |
43 |
44 | def test_9_brackets():
45 | output = laurelin.balanced_brackets("[///\\|||]")
46 | assert output == True
47 |
48 |
49 | def test_10_brackets():
50 | output = laurelin.balanced_brackets("!@#$%%^&*(;',.<>?/\|~`'")
51 | assert output == False
52 |
--------------------------------------------------------------------------------
/challenges/2021-07-27-boustrophedon/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2021-07-27-boustrophedon/run-tests.sh:
--------------------------------------------------------------------------------
1 | ../../resources/javascript/js-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2021-07-27-boustrophedon/solution.test.js:
--------------------------------------------------------------------------------
1 | const { Node, boustrophedon } = require('./solution');
2 |
3 | test('Can correctly read out sample tree one', () => {
4 | var tree = new Node(
5 | 'a',
6 | new Node('b', new Node('d'), new Node('e')),
7 | new Node('c', new Node('f'), new Node('g'))
8 | );
9 | var expected = "acbdefg".split("");
10 | expect(boustrophedon(tree)).toStrictEqual(expected);
11 | })
12 |
13 |
14 | test('Can correctly read out sample tree two', () => {
15 | var tree = new Node(
16 | 'p',
17 | new Node(
18 | 'o',
19 | new Node('g', new Node('n'), new Node('o')),
20 | new Node('n', new Node('i'), new Node('t'))
21 | ),
22 | new Node(
23 | 'r',
24 | new Node('o', new Node('a'), new Node('c')),
25 | new Node('s', new Node('i'), new Node('t'))
26 | )
27 | );
28 | var expected = "prognostication".split("");
29 | expect(boustrophedon(tree)).toStrictEqual(expected);
30 | })
31 |
32 |
--------------------------------------------------------------------------------
/challenges/2021-07-27-boustrophedon/solutions/javascript/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-07-27-boustrophedon/solutions/javascript/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2021-07-27-boustrophedon/solutions/typescript/jest.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('@ts-jest/dist/types').InitialOptionsTsJest} */
2 | module.exports = {
3 | preset: 'ts-jest',
4 | testEnvironment: 'node',
5 | };
--------------------------------------------------------------------------------
/challenges/2021-07-27-boustrophedon/solutions/typescript/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "typescript",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "npx jest"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "devDependencies": {
13 | "jest": "^27.0.6",
14 | "typescript": "^4.3.5"
15 | },
16 | "dependencies": {
17 | "@types/jest": "^26.0.24",
18 | "ts-jest": "^27.0.4"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/challenges/2021-07-27-boustrophedon/solutions/typescript/xanderyzwich/solution.test.ts:
--------------------------------------------------------------------------------
1 | import { Node, boustrophedon } from './solution';
2 |
3 | describe("Testing my solution", () => {
4 |
5 | test('Can correctly read out sample tree one', () => {
6 | var tree = new Node(
7 | 'a',
8 | new Node('b', new Node('d'), new Node('e')),
9 | new Node('c', new Node('f'), new Node('g'))
10 | );
11 | var expected = "acbdefg".split("");
12 | expect(boustrophedon(tree)).toStrictEqual(expected);
13 | })
14 |
15 |
16 | test('Can correctly read out sample tree two', () => {
17 | var tree = new Node(
18 | 'p',
19 | new Node(
20 | 'o',
21 | new Node('g', new Node('n'), new Node('o')),
22 | new Node('n', new Node('i'), new Node('t'))
23 | ),
24 | new Node(
25 | 'r',
26 | new Node('o', new Node('a'), new Node('c')),
27 | new Node('s', new Node('i'), new Node('t'))
28 | )
29 | );
30 | var expected = "prognostication".split("");
31 | expect(boustrophedon(tree)).toStrictEqual(expected);
32 | })
33 | })
--------------------------------------------------------------------------------
/challenges/2021-08-03-tracing-triangles/TracingTriangles.cs:
--------------------------------------------------------------------------------
1 | using Xunit;
2 |
3 | public class TracingTriangles
4 | {
5 | public int LongestPath(int[][] triangle)
6 | {
7 | // Insert your solution code here
8 | return 0;
9 | }
10 |
11 | [Fact]
12 | public void Test_case_one_()
13 | {
14 | int[][] input = new int[][] {new[] {1}, new[] {2, 3}, new[] {1, 5, 1}};
15 | Assert.Equal(9, LongestPath(input));
16 | }
17 |
18 | [Fact]
19 | public void Test_case_two_()
20 | {
21 | int[][] input = new int[][] {new[] {6}, new[] {4, 4}, new[] {1, 2, 1}, new[] {5, 4, 3, 2}};
22 | Assert.Equal(16, LongestPath(input));
23 | }
24 |
25 | [Fact]
26 | public void Test_case_three_()
27 | {
28 | int[][] input = new int[][] {new[] {5}};
29 | Assert.Equal(5, LongestPath(input));
30 | }
31 |
32 | [Fact]
33 | public void Test_case_four_()
34 | {
35 | int[][] input = new int[][] {new[] {1}, new[] {1, 1}, new[] {1, 1, 1}, new[] {2, 1, 1, 1}};
36 | Assert.Equal(5, LongestPath(input));
37 | }
38 |
39 | [Fact]
40 | public void Test_case_five_()
41 | {
42 | int[][] input = new int[][] {new[] {0}, new[] {0, 0}, new[] {0, 0, 0}};
43 | Assert.Equal(0, LongestPath(input));
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/challenges/2021-08-03-tracing-triangles/TracingTriangles.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/challenges/2021-08-03-tracing-triangles/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/csharp/csharp-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2021-08-03-tracing-triangles/solutions/csharp/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-08-03-tracing-triangles/solutions/csharp/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2021-08-03-tracing-triangles/solutions/go/drkennetz/drkennetz.go:
--------------------------------------------------------------------------------
1 | package drkennetz
2 |
3 | import (
4 | "math"
5 | )
6 |
7 | func LongestPath(a [][]int) int {
8 | store := make([]int, len(a))
9 | n := len(a) - 1
10 |
11 | // store the bottom row
12 | for i := 0; i < len(a[n]); i++ {
13 | store[i] = a[n][i]
14 | }
15 | // walk backwards through the rows starting from the second to last
16 | for i := len(a) - 2; i >= 0; i-- {
17 | // walk through the items in each row by index
18 | for j := 0; j < len(a[i]); j++ {
19 | // update the store at each index with the array's current value plus the max of the store current and store next
20 | max := math.Max(float64(store[j]), float64(store[j + 1]) )
21 | store[j] = a[i][j] + int(max)
22 | }
23 | }
24 | return store[0]
25 | }
--------------------------------------------------------------------------------
/challenges/2021-08-03-tracing-triangles/solutions/go/drkennetz/drkennetz_test.go:
--------------------------------------------------------------------------------
1 | package drkennetz
2 |
3 | import (
4 | "fmt"
5 | "testing"
6 | )
7 |
8 | func TestLongestPath(t *testing.T) {
9 | tables := []struct {
10 | input [][]int
11 | result int
12 | }{
13 | {[][]int{[]int{1}, []int{2, 3}, []int{1, 5, 1}}, 9},
14 | {[][]int{[]int{6}, []int{4, 4}, []int{1, 2, 1}, []int{5,4,3,2}}, 16},
15 | {[][]int{[]int{5}}, 5},
16 | {[][]int{[]int{1}, []int{1, 1}, []int{1, 1, 1}, []int{2, 1, 1, 1}}, 5},
17 | {[][]int{[]int{0}, []int{0,0}, []int{0,0,0}}, 0},
18 | }
19 | for _, table := range tables {
20 | actual := LongestPath(table.input)
21 | if actual != table.result {
22 | fmt.Println("FAIL, expected: ", table.result, "got: ", actual)
23 | } else {
24 | fmt.Println("SUCCESS!")
25 | }
26 | }
27 | }
28 |
29 | func BenchmarkLongestPath(b *testing.B) {
30 | for n := 0; n < b.N; n++ {
31 | LongestPath([][]int{[]int{6}, []int{4, 4}, []int{1, 2, 1}, []int{5,4,3,2}})
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/challenges/2021-08-03-tracing-triangles/solutions/go/drkennetz/go.mod:
--------------------------------------------------------------------------------
1 | module drkennetz
2 |
3 | go 1.15
4 |
--------------------------------------------------------------------------------
/challenges/2021-08-03-tracing-triangles/solutions/julia/ericwburden/ericwburden.jl:
--------------------------------------------------------------------------------
1 | module tracingtriangle # --------------------------------------------------------------
2 |
3 | export longest_path
4 |
5 | function longest_path(tree, row=1, col=1)
6 | row == length(tree) && return tree[row][col]
7 |
8 | left = longest_path(tree, row + 1, col)
9 | right = longest_path(tree, row + 1, col + 1)
10 | return max(left, right) + tree[row][col]
11 | end
12 |
13 | end # module tracingtriangle
14 |
15 |
16 | module test # -------------------------------------------------------------------------
17 |
18 | using Test
19 | using ..tracingtriangle
20 |
21 | @testset "Sample Test" begin
22 | input_one = [[1], [2, 3], [1, 5, 1]]
23 | @test longest_path(input_one) == 9
24 |
25 | input_two = [[6], [4, 4], [1, 2, 1], [5, 4, 3, 2]]
26 | @test longest_path(input_two) == 16
27 |
28 | input_three = [[5]]
29 | @test longest_path(input_three) == 5
30 |
31 | input_four = [[1], [1, 1], [1, 1, 1], [2, 1, 1, 1]]
32 | @test longest_path(input_four) == 5
33 |
34 | input_five = [[0], [0, 0], [0, 0, 0]]
35 | @test longest_path(input_five) == 0
36 | end
37 |
38 | end # module test
39 |
--------------------------------------------------------------------------------
/challenges/2021-08-10-sort-window/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2021-08-10-sort-window/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/javascript/js-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2021-08-10-sort-window/solution.js:
--------------------------------------------------------------------------------
1 | // # Sort Window
2 | //
3 | // Given an array of integers out of order, determine the bounds of the smallest
4 | // window that must be sorted in order for the entire array to be sorted. For example,
5 | // given [3, 7, 5, 6, 9], you should return (1, 3).
6 | //
7 | // ## Business Rules/Errata
8 | //
9 | // - Your input will be an array of unsigned integers.
10 | // - An empty array is considered to be sorted.
11 | // - You should return an array, with the first element containing the 'start' of the
12 | // window, and the second element containing the 'end' of the window.
13 | // - If your input array is already sorted, return an empty array.
14 | // - Note: Some of the elements inside the unsorted window may actually be in the
15 | // correct order for the final sorted array.
16 |
17 |
18 | function sortWindow(input) {
19 | // Insert your solution code here
20 | }
21 |
22 | module.exports = { sortWindow };
23 |
--------------------------------------------------------------------------------
/challenges/2021-08-10-sort-window/solution.test.js:
--------------------------------------------------------------------------------
1 | const { sortWindow } = require('./solution');
2 |
3 | test('Identify a sort window in the middle of the array', () => {
4 | expect(sortWindow([3, 7, 5, 6, 9])).toStrictEqual([2, 4])
5 | })
6 |
7 | test('Identify a sort window at the end of the array', () => {
8 | expect(sortWindow([1, 2, 6, 5, 4])).toStrictEqual([3, 5])
9 | })
10 |
11 | test('Identify a sort window at the beginning of the array', () => {
12 | expect(sortWindow([3, 2, 1, 4, 5])).toStrictEqual([1, 3])
13 | })
14 |
15 | test('Identify a sort window that covers the whole array', () => {
16 | expect(sortWindow([5, 4, 3, 2, 1])).toStrictEqual([1, 5])
17 | })
18 |
19 | test('Identify an already sorted array', () => {
20 | expect(sortWindow([1, 2, 3, 4, 5])).toStrictEqual([])
21 | })
22 |
23 | test('Identify a single item array as already sorted', () => {
24 | expect(sortWindow([1])).toStrictEqual([])
25 | })
26 |
27 | test('Identify an empty array as already sorted', () => {
28 | expect(sortWindow([])).toStrictEqual([])
29 | })
30 |
31 |
--------------------------------------------------------------------------------
/challenges/2021-08-10-sort-window/solutions/javascript/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-08-10-sort-window/solutions/javascript/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2021-08-17-friend-finder/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/java/java-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2021-08-17-friend-finder/solutions/javascript/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-08-17-friend-finder/solutions/javascript/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2021-08-24-dominoes-descending/go.mod:
--------------------------------------------------------------------------------
1 | module solution
2 |
3 | go 1.14
4 |
--------------------------------------------------------------------------------
/challenges/2021-08-24-dominoes-descending/solution_test.go:
--------------------------------------------------------------------------------
1 | package solution
2 |
3 | import (
4 | "fmt"
5 | "log"
6 | "testing"
7 | )
8 |
9 | func TestTopple(t *testing.T) {
10 | tables := []struct {
11 | input string
12 | result string
13 | } {
14 | {".L.R....L", "LL.RRRLLL"},
15 | {"L.......R", "L.......R"},
16 | {"R........", "RRRRRRRRR"},
17 | {"........L", "LLLLLLLLL"},
18 | {"RLRLRLRLR", "RLRLRLRLR"},
19 | {"R..L.R..L", "RRLL.RRLL"},
20 | {"...L.R...", "LLLL.RRRR"},
21 | {"R.......L", "RRRR.LLLL"},
22 | }
23 |
24 | for idx, table := range tables {
25 | actual := Topple(table.input)
26 | if actual != table.result {
27 | log.Fatalln("Test ", idx+1, " FAIL: Expected: ", table.result, "GOT: ", actual)
28 | } else {
29 | fmt.Println("SUCCESS!")
30 | }
31 | }
32 | }
33 |
34 | func BenchmarkTopple(b *testing.B) {
35 | for n := 0; n < b.N; n++ {
36 | Topple(".L.R....L")
37 | }
38 | }
--------------------------------------------------------------------------------
/challenges/2021-08-24-dominoes-descending/solutions/julia/ericwburden/ericwburden_tests.jl:
--------------------------------------------------------------------------------
1 | using Test;
2 | using julia;
3 |
4 | @testset "Sample Test" begin
5 | @test topplebyforce(".L.R....L") == "LL.RRRLLL"
6 | @test topplebyforce("L.......R") == "L.......R"
7 | @test topplebyforce("R........") == "RRRRRRRRR"
8 | @test topplebyforce("........L") == "LLLLLLLLL"
9 | @test topplebyforce("RLRLRLRLR") == "RLRLRLRLR"
10 | @test topplebyforce("R..L.R..L") == "RRLL.RRLL"
11 | @test topplebyforce("...L.R...") == "LLLL.RRRR"
12 | @test topplebyforce("R.......L") == "RRRR.LLLL"
13 |
14 | @test topplebyboundary(".L.R....L") == "LL.RRRLLL"
15 | @test topplebyboundary("L.......R") == "L.......R"
16 | @test topplebyboundary("R........") == "RRRRRRRRR"
17 | @test topplebyboundary("........L") == "LLLLLLLLL"
18 | @test topplebyboundary("RLRLRLRLR") == "RLRLRLRLR"
19 | @test topplebyboundary("R..L.R..L") == "RRLL.RRLL"
20 | @test topplebyboundary("...L.R...") == "LLLL.RRRR"
21 | @test topplebyboundary("R.......L") == "RRRR.LLLL"
22 | end
23 |
--------------------------------------------------------------------------------
/challenges/2021-08-31-zero-point/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2021-08-31-zero-point/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/javascript/js-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2021-08-31-zero-point/solution.js:
--------------------------------------------------------------------------------
1 | // # Zero Point
2 | //
3 | // Given a linked list, remove all consecutive nodes that sum to zero.
4 | // For example, suppose you are given the input `3 -> 4 -> -7 -> 5 -> -6 -> 6`. In
5 | // this case, you should first remove `3 -> 4 -> -7`, then `-6 -> 6`, leaving only `5`.
6 | //
7 | // ## Business Rules/Errata
8 | //
9 | // - ***Data Structure Required: Linked List***
10 | // - Your input will be a linked list, where each node represents either a positive or
11 | // negative integer.
12 | // - Your return value should be in the form of a linked list containing only nodes
13 | // that are not part of a consecutive sequence that sums to zero.
14 | // - If your input linked list does not contain any nodes that qualify to be returned
15 | // (such as `1 -> -1`), return `NULL` (or your language's equivalent).
16 | // - Your input will contain at least one node with a value.
17 |
18 | class ListNode {
19 | constructor(value) {
20 | this.value = value
21 | this.next = null
22 | }
23 | }
24 |
25 | function removeZeroSequences(input) {
26 | // Insert your solution code here
27 | }
28 |
29 | module.exports = { ListNode, removeZeroSequences };
30 |
--------------------------------------------------------------------------------
/challenges/2021-08-31-zero-point/solutions/javascript/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-08-31-zero-point/solutions/javascript/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2021-09-14-fast-peak-picker/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2021-09-14-fast-peak-picker/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/javascript/js-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2021-09-14-fast-peak-picker/solution.js:
--------------------------------------------------------------------------------
1 | // # Fast Peak Picker
2 | //
3 | // Given a array that's sorted but rotated at some unknown pivot, in which all
4 | // elements are distinct, find the "peak" element. An element is considered a peak if it
5 | // is greater than both its left and right neighbors. For example, `[1, 2, 3, 2, 1]`
6 | // has a peak element of `3`.
7 | //
8 | // ## Business Rules/Errata
9 | //
10 | // - The input will always consist of an array of numbers containing at least one element.
11 | // - The first element in the array is always considered to be "larger" than the
12 | // (non-existent) element to its left.
13 | // - The last element in the array is always considered to be "larger" than the
14 | // (non-existent) element to its right.
15 | // - It is possible to solve this problem in less than O(n) time, attempt to find a
16 | // more efficient solution.
17 | //
18 | // ## Examples
19 | //
20 | // ```
21 | // pick_peak([1, 2, 3, 2, 1]); // 3
22 | // pick_peak([1, 2, 3, 4, 5]); // 5
23 | // pick_peak([5, 4, 3, 2, 1]); // 5
24 | // pick_peak([1]); // 1
25 | // ```
26 |
27 | function pickPeak(input) {
28 | // Insert your solution code here
29 | }
30 |
31 | module.exports = { pickPeak };
32 |
--------------------------------------------------------------------------------
/challenges/2021-09-14-fast-peak-picker/solution.test.js:
--------------------------------------------------------------------------------
1 | const { pickPeak } = require('./solution');
2 |
3 | test('Find a peak in the middle', () => {
4 | expect(pickPeak([1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1])).toStrictEqual(7);
5 | })
6 |
7 | test('Find a peak in the middle, skip count', () => {
8 | expect(pickPeak([0, 25, 150, 600, 400, 225, 75])).toStrictEqual(600);
9 | })
10 |
11 | test('Find a peak at the end', () => {
12 | expect(pickPeak([2, 4, 6, 8])).toStrictEqual(8);
13 | })
14 |
15 | test('Find a peak at the beginning', () => {
16 | expect(pickPeak([100, 50, 25, 12.5, 6.25])).toStrictEqual(100);
17 | })
18 |
19 | test('Find a peak in a one-element array', () => {
20 | expect(pickPeak([99])).toStrictEqual(99);
21 | })
22 |
23 | test('Find a peak in a sneaky one-element array', () => {
24 | expect(pickPeak([0])).toStrictEqual(0);
25 | })
26 |
27 | test('Find a peak in a really big array, and time it!', () => {
28 | let input = [...Array(1000000).keys()];
29 | let t0 = performance.now();
30 | let result = pickPeak(input);
31 | let t1 = performance.now();
32 | console.log("Finding the peak of a big array took " + (t1 - t0) + " milliseconds.")
33 | expect(result).toStrictEqual(999999);
34 | })
35 |
36 |
--------------------------------------------------------------------------------
/challenges/2021-09-14-fast-peak-picker/solutions/go/drkennetz/drkennetz.go:
--------------------------------------------------------------------------------
1 | package drkennetz
2 |
3 | // FastPeakPicker implements a binary search to find the peak value in the array
4 | func FastPeakPicker(peaks []int) int {
5 | lower := 0
6 | upper := len(peaks)-1
7 | for lower <= upper {
8 | middle := lower + (upper - lower)/2
9 | if middle == 0 || middle == len(peaks) - 1 {
10 | // we've hit the upper or lower bound
11 | return peaks[middle]
12 | }
13 | if peaks[middle] > peaks[middle - 1] && peaks[middle] > peaks[middle + 1] {
14 | // we found the value we're looking for
15 | return peaks[middle]
16 | } else if peaks[middle] > peaks[middle - 1] {
17 | // we want to use the right half
18 | lower = middle + 1
19 | } else {
20 | // we want to use the left halfis
21 | upper = middle - 1
22 | }
23 | }
24 |
25 | return -1
26 | }
27 |
28 | // LinearFastPeakPicker implements a linear search to find the peak value in the array
29 | func LinearFastPeakPicker(peaks []int) int {
30 | upper := len(peaks) - 1
31 | for i := 0; i < len(peaks); i++ {
32 | if i == upper {
33 | return peaks[i]
34 | } else if peaks[i] > peaks[i+1] {
35 | return peaks[i]
36 | }
37 | }
38 | return -1
39 | }
--------------------------------------------------------------------------------
/challenges/2021-09-14-fast-peak-picker/solutions/go/drkennetz/go.mod:
--------------------------------------------------------------------------------
1 | module drkennetz
2 |
3 | go 1.15
4 |
--------------------------------------------------------------------------------
/challenges/2021-09-14-fast-peak-picker/solutions/javascript/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-09-14-fast-peak-picker/solutions/javascript/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2021-09-20-tic-tac-toe-winner/solutions/ruby/Gemfile:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | source "https://rubygems.org"
4 |
5 | gem 'minitest'
6 |
--------------------------------------------------------------------------------
/challenges/2021-09-20-tic-tac-toe-winner/solutions/ruby/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | minitest (5.14.4)
5 | rake (13.0.6)
6 |
7 | PLATFORMS
8 | ruby
9 |
10 | DEPENDENCIES
11 | minitest
12 | rake
13 |
14 | BUNDLED WITH
15 | 2.1.4
16 |
--------------------------------------------------------------------------------
/challenges/2021-09-20-tic-tac-toe-winner/solutions/ruby/brehberg/brehberg.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 | POSSIBLE_ROWS = [
3 | [1,2,3],
4 | [4,5,6],
5 | [7,8,9],
6 | [1,4,7],
7 | [2,5,8],
8 | [3,6,9],
9 | [1,5,9],
10 | [3,5,7]
11 | ].freeze
12 |
13 | def who_wins(board)
14 | state = []
15 |
16 | # populate the board state
17 | board.each.with_index(1) do |move, index|
18 | row, col = move
19 | state[row*3+col+1] = index.odd? ? 'A' : 'B'
20 | end
21 |
22 | # check for winning rows
23 | POSSIBLE_ROWS.each do |row|
24 | i, j, k = row
25 | if (state[i] == state[j] && state[i] == state[k])
26 | return state[i] unless state[i].nil?
27 | end
28 | end
29 |
30 | # check for draw or in process game
31 | return board.length() == 9 ? 'Draw' : 'Pending'
32 | end
--------------------------------------------------------------------------------
/challenges/2021-09-20-tic-tac-toe-winner/solutions/ruby/mob.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | MAGIC_SQUARE =[[2,7,6],
4 | [9,5,1],
5 | [4,3,8]].freeze
6 |
7 | def is_winner?(player_moves)
8 | player_combo = player_moves.combination(3)
9 | player_combo.any? {|combo| combo.sum == 15}
10 | end
11 |
12 | def who_wins(board)
13 | a_moves = []
14 | b_moves = []
15 |
16 | board.each.with_index(1) do |move, idx|
17 | # [0,0]
18 | row, col = move
19 | a_moves << MAGIC_SQUARE[row][col] if idx.odd?
20 | b_moves << MAGIC_SQUARE[row][col] if idx.even?
21 | end
22 | return 'Pending' if a_moves.length < 3
23 | return 'A' if is_winner?(a_moves)
24 | return 'B' if is_winner?(b_moves)
25 |
26 | board.length == 9 ? 'Draw' : 'Pending'
27 | end
28 |
--------------------------------------------------------------------------------
/challenges/2021-09-28-minimum-impossible-sum/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2021-09-28-minimum-impossible-sum/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/javascript/js-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2021-09-28-minimum-impossible-sum/solution.js:
--------------------------------------------------------------------------------
1 | //# Minimum Impossible Sum
2 | //
3 | //Given a sorted array of integers, find the smallest positive integer that is not the sum of a subset of the array.
4 | //
5 | //## Business Rules/Errata
6 | //
7 | //- Your input will be an array of integers, sorted in ascending order (smallest to largest).
8 | //- Your input will always contain at least one number.
9 | //- Your answer should be a positive integer larger than zero.
10 | //- You do not need to account for integer overflow (i.e., the answer should always be a 32-bit positive number, in the range from 0 to 4,294,967,295).
11 | //- Bonus: Can you solve this challenge in linear (O(n)) time?
12 | //
13 | //## Examples
14 | //
15 | //```
16 | //min_impossible_sum([5]) // 1
17 | //min_impossible_sum([1]) // 2
18 | //min_impossible_sum([1, 2, 3, 10]) // 7
19 | //min_impossible_sum([1, 2, 3, 7, 10]) // 24
20 | //
21 | //```
22 |
23 | function minImpossibleSum(array) {
24 | // Insert your solution code here
25 | }
26 |
27 | module.exports = { minImpossibleSum };
28 |
--------------------------------------------------------------------------------
/challenges/2021-09-28-minimum-impossible-sum/solution.test.js:
--------------------------------------------------------------------------------
1 | const { minImpossibleSum } = require('./solution');
2 |
3 | test('Return 1 if array is length 1 and num is greater than 1', () => {
4 | expect(minImpossibleSum([5])).toStrictEqual(1);
5 | })
6 |
7 | test('Return 2 if array is length 1 and num is 1', () => {
8 | expect(minImpossibleSum([1])).toStrictEqual(2);
9 | })
10 |
11 | test('Return a sum where only a subset of the numbers is used', () => {
12 | expect(minImpossibleSum([1, 2, 3, 10])).toStrictEqual(7)
13 | })
14 |
15 | test('Return a sum where all of the numbers are used', () => {
16 | expect(minImpossibleSum([1, 2, 3, 7, 10])).toStrictEqual(24)
17 | })
18 |
--------------------------------------------------------------------------------
/challenges/2021-09-28-minimum-impossible-sum/solutions/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-09-28-minimum-impossible-sum/solutions/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2021-09-28-minimum-impossible-sum/solutions/mob/mob.js:
--------------------------------------------------------------------------------
1 | //# Minimum Impossible Sum
2 | //
3 | //Given a sorted array of integers, find the smallest positive integer that is not the sum of a subset of the array.
4 | //
5 | //## Business Rules/Errata
6 | //
7 | //- Your input will be an array of integers, sorted in ascending order (smallest to largest).
8 | //- Your input will always contain at least one number.
9 | //- Your answer should be a positive integer larger than zero.
10 | //- You do not need to account for integer overflow (i.e., the answer should always be a 32-bit positive number, in the range from 0 to 4,294,967,295).
11 | //- Bonus: Can you solve this challenge in linear (O(n)) time?
12 | //
13 | //## Examples
14 | //
15 | //```
16 | //min_impossible_sum([5]) // 1
17 | //min_impossible_sum([1]) // 2
18 | //min_impossible_sum([1, 2, 3, 10]) // 7
19 | //min_impossible_sum([1, 2, 3, 7, 10]) // 24
20 | //
21 | //```
22 |
23 | function minImpossibleSum(array) {
24 | // Insert your solution code here
25 | let res = 1;
26 | for (let i = 0; i < array.length; i++) {
27 | if(array[i] > res) return res;
28 | res += array[i];
29 | }
30 | return res;
31 | }
32 |
33 | module.exports = { minImpossibleSum };
34 |
--------------------------------------------------------------------------------
/challenges/2021-10-05-limited-levenshtein-leap/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2021-10-05-limited-levenshtein-leap/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/javascript/js-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2021-10-05-limited-levenshtein-leap/solution.js:
--------------------------------------------------------------------------------
1 | // # Limited Levenshtein Leap
2 | //
3 | // Given a `start` word, and `end` word, and a "dictionary" of valid words, find the
4 | // shortest transformation sequence from `start` to `end` such that only one letter is
5 | // changed at each step of the sequence, and each transformed word exists in the
6 | // dictionary. If there is no possible transformation, return NULL.
7 | //
8 | // ## Business Rules/Errata
9 | //
10 | // - The "dictionary" is simply an unordered array of strings.
11 | // - The `start`, `stop`, and "dictionary" words will all be the same length and all
12 | // lowercase.
13 | // - Your function should return the sequence of words that represent the
14 | // transformations from start to end.
15 | //
16 | // ## Examples
17 | //
18 | // ### Example 1
19 | //
20 | // ```
21 | // start = "dog"
22 | // end = "cat"
23 | // dictionary = ["dot", "dop", "dat", "cat"]
24 | // findTransformSequence(start, end, dictionary) // ["dog", "dot", "dat", "cat"]
25 | // ```
26 | //
27 | // ### Example 2
28 | //
29 | // ```
30 | // start = "dog"
31 | // end = "cat"
32 | // dictionary = ["dot", "tod", "dat", "dar"]
33 | // findTransformSequence(start, end, dictionary) // NULL
34 | // ```
35 |
36 | function findTransformSequence(array) {
37 | // Insert your solution code here
38 | }
39 |
40 | module.exports = { findTransformSequence };
41 |
--------------------------------------------------------------------------------
/challenges/2021-10-05-limited-levenshtein-leap/solutions/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-10-05-limited-levenshtein-leap/solutions/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2021-10-12-monotonic-array/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2021-10-12-monotonic-array/solutions/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-10-12-monotonic-array/solutions/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2021-10-19-zig-zag-print/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2021-10-19-zig-zag-print/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/javascript/js-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2021-10-19-zig-zag-print/solution.test.js:
--------------------------------------------------------------------------------
1 | const { printZigZag } = require('./solution');
2 |
3 | test('Should produce desired result from "bismarcks", 3', () => {
4 | let result = printZigZag("bismarcks", 3)
5 | let expected = "b a s\n i m r k \n s c "
6 | expect(result).toEqual(expected)
7 | })
8 |
9 | test('Should produce desired result from "thisisazigzag", 4', () => {
10 | let result = printZigZag("thisisazigzag", 4)
11 | let expected = "t a g\n h s z a \n i i i z \n s g "
12 | expect(result).toEqual(expected)
13 | })
14 |
15 | test('Should produce desired result from "ilovechickenandwaffles", 3', () => {
16 | let result = printZigZag("ilovechickenandwaffles", 3)
17 | let expected = "i e c a a e \n l v c i k n n w f l s\n o h e d f "
18 | expect(result).toEqual(expected);
19 | })
20 |
21 | test('Should produce desired result from "h e l l o", 2', () => {
22 | let result = printZigZag("h e l l o", 2);
23 | let expected = "h e l l o\n "
24 | expect(result).toEqual(expected);
25 | })
26 |
--------------------------------------------------------------------------------
/challenges/2021-10-26-the-24-game/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/python/python-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2021-10-26-the-24-game/solutions/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-10-26-the-24-game/solutions/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2021-11-02-pragmatic-pipes/solution/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "solution"
3 | version = "0.1.0"
4 | edition = "2018"
5 |
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7 |
8 | [dependencies]
9 |
--------------------------------------------------------------------------------
/challenges/2021-11-02-pragmatic-pipes/solutions/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-11-02-pragmatic-pipes/solutions/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2021-11-09-look-and-say-sequence/challenge.md:
--------------------------------------------------------------------------------
1 | # Look and Say Sequence
2 |
3 | [From CodeWars](https://www.codewars.com/kata/5263c5d011f4233c9d000561)
4 |
5 | In mathematics, the look-and-say sequence is the sequence of integers beginning as follows:
6 |
7 | `1, 11, 21, 1211, 111221, 312211, …`
8 |
9 | To generate a member of the sequence from the previous member, read off the digits of
10 | the previous member, counting the number of digits in groups of the same digit. For
11 | example:
12 |
13 | ```
14 | 1 is read off as "one 1" or 11.
15 | 11 is read off as "two 1s" or 21.
16 | 21 is read off as "one 2, then one 1" or 1211.
17 | 1211 is read off as "one 1, then one 2, then two 1s" or 111221.
18 | 111221 is read off as "three 1s, then two 2s, then one 1" or 312211.
19 | ```
20 |
21 | Your mission is to write a function which, given an integer n as parameter, returns a
22 | comma separated list of the first n terms of the sequence. For 0, an empty string
23 | shall be returned.
24 |
25 | For example:
26 |
27 | ```
28 | get_lines(2); // "1,11"
29 | get_lines(3); // "1,11,21"
30 | get_lines(5); // "1,11,21,1211,111221"
31 | ```
32 |
33 |
--------------------------------------------------------------------------------
/challenges/2021-11-09-look-and-say-sequence/solution/Cargo.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Cargo.
2 | # It is not intended for manual editing.
3 | version = 3
4 |
5 | [[package]]
6 | name = "solution"
7 | version = "0.1.0"
8 |
--------------------------------------------------------------------------------
/challenges/2021-11-09-look-and-say-sequence/solution/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "solution"
3 | version = "0.1.0"
4 | edition = "2018"
5 |
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7 |
8 | [dependencies]
9 |
--------------------------------------------------------------------------------
/challenges/2021-11-09-look-and-say-sequence/solutions/go/drkennetz/drkennetz_test.go:
--------------------------------------------------------------------------------
1 | package drkennetz
2 |
3 | import (
4 | "fmt"
5 | "log"
6 | "testing"
7 | )
8 |
9 | func TestGetLines(t *testing.T) {
10 | tables := []struct {
11 | input int
12 | result string
13 | } {
14 | {1, "1"},
15 | {2, "1,11"},
16 | {3, "1,11,21"},
17 | {5, "1,11,21,1211,111221"},
18 | {6, "1,11,21,1211,111221,312211"},
19 | }
20 | for _, table := range tables {
21 | actual := GetLines(table.input)
22 | if actual != table.result {
23 | log.Fatalln("FAIL, GOT: ", actual, "EXPECTED: ", table.result)
24 | } else {
25 | fmt.Println("SUCCESS, GOT: ", actual, "EXPECTED: ", table.result)
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/challenges/2021-11-09-look-and-say-sequence/solutions/go/drkennetz/go.mod:
--------------------------------------------------------------------------------
1 | module drkennetz
2 |
3 | go 1.14
4 |
--------------------------------------------------------------------------------
/challenges/2021-11-09-look-and-say-sequence/solutions/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-11-09-look-and-say-sequence/solutions/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2021-11-16-data-grouping/generate_random_hs.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import sys
4 | import random
5 |
6 | num_randoms = int(sys.argv[1])
7 |
8 | years = ["Freshman", "Sophomore", "Junior", "Senior"]
9 |
10 | weighted_list = random.choices(years, weights=(10, 20, 40, 30), k=num_randoms)
11 | act_scores = random.choices(range(18, 37), weights=(2, 3, 5, 10, 12, 12, 10, 10, 8, 7, 6, 5, 4, 3, 2, 2, 1, 1, 1), k=num_randoms)
12 |
13 |
14 | f = open('HS_ACT_Data.txt', 'w')
15 | f.write("HighSchool Year\tACT Score\n")
16 | for year, score in zip(weighted_list, act_scores):
17 | f.write(year + '\t' + str(score) + '\n')
18 |
19 | f.close()
20 |
--------------------------------------------------------------------------------
/challenges/2021-11-16-data-grouping/solution.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | def wrangle_data(data):
4 | pass
5 |
--------------------------------------------------------------------------------
/challenges/2021-11-16-data-grouping/solutions/javascript/justinmemphis/justinmemphis.test.js:
--------------------------------------------------------------------------------
1 | const { groupData } = require("./justinmemphis");
2 |
3 | test("Freshman Mean and Median", () => {
4 | const result = groupData();
5 | expect(result["Freshman Mean"]).toEqual(24.4);
6 | expect(result["Freshman Median"]).toEqual(23);
7 | });
8 |
9 | test("Sophomore Mean and Median", () => {
10 | const result = groupData();
11 | expect(result["Sophomore Mean"]).toEqual(25.0);
12 | expect(result["Sophomore Median"]).toEqual(24);
13 | });
14 |
15 | test("Junior Mean and Median", () => {
16 | const result = groupData();
17 | expect(result["Junior Mean"]).toEqual(24.6);
18 | expect(result["Junior Median"]).toEqual(24);
19 | });
20 |
21 | test("Senior Mean and Median", () => {
22 | const result = groupData();
23 | expect(result["Senior Mean"]).toEqual(25.2);
24 | expect(result["Senior Median"]).toEqual(25);
25 | });
26 |
27 | test("Scores Over 25", () => {
28 | const result = groupData();
29 | expect(result["Scores Over 25"]).toEqual(730);
30 | });
31 |
32 | test("Sophomore Scores Between 25 and 30", () => {
33 | const result = groupData();
34 | expect(result["Sophomore Scores Between 25 and 30"]).toEqual(84);
35 | });
36 |
37 | test("Sophomore and Junior Mean", () => {
38 | const result = groupData();
39 | expect(result["Sophomore and Junior Mean"]).toEqual(24.7);
40 | });
41 |
--------------------------------------------------------------------------------
/challenges/2021-11-16-data-grouping/solutions/javascript/justinmemphis/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2021-11-16-data-grouping/solutions/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-11-16-data-grouping/solutions/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2021-11-30-weird-column-naming/package.json:
--------------------------------------------------------------------------------
1 | ../../resources/javascript/package.json
--------------------------------------------------------------------------------
/challenges/2021-11-30-weird-column-naming/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/javascript/js-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2021-11-30-weird-column-naming/solution.js:
--------------------------------------------------------------------------------
1 | // # Weird Column Naming
2 | //
3 | // Spreadsheets often use an alphabetical encoding for naming columns: "A", "B", "C", ..., "AA", "AB", ..., "ZZ", "AAA", "AAB", ....
4 | //
5 | // Given a column number, return its alphabetical column id. For example, given 1, return "A". Given 27, return "AA".
6 | //
7 | // ## Business Rules/Errata
8 | //
9 | // - Your function should take an unsigned integer greater than 0. Return an error if a number 0 or less is given.
10 | // - Hint: Note that the format "A", "B", "C", ..., "AA", "AB", ..., "ZZ", "AAA", "AAB", .... does not support the concept of "zero".
11 | // - This challenge should be attempted with at Test-Driven Development (TDD) methodology. For more information on TDD, see [this video](https://www.youtube.com/watch?v=llaUBH5oayw).
12 | //
13 | // ## Examples
14 | //
15 | // ```
16 | // to_spreadsheet_colname(1); // "A"
17 | // to_spreadsheet_colname(27); // "AA"
18 | // to_spreadsheet_colname(52); // "AZ"
19 | // to_spreadsheet_colname(287); // "KA"
20 | // ```
21 |
22 | function to_spreadsheet_colname(integer) {
23 | // insert your solution code here
24 | }
25 |
26 | module.exports = { to_spreadsheet_colname };
27 |
--------------------------------------------------------------------------------
/challenges/2021-11-30-weird-column-naming/solution.test.js:
--------------------------------------------------------------------------------
1 | const { to_spreadsheet_colname } = require('./solution');
2 |
3 | test('Return A if number is 1', () => {
4 | expect(to_spreadsheet_colname(1)).toStrictEqual("A");
5 | })
6 |
7 | test('Return AA if number is 27', () => {
8 | expect(to_spreadsheet_colname(27)).toStrictEqual("AA");
9 | })
10 |
11 | test('Return AZ if number is 52', () => {
12 | expect(to_spreadsheet_colname(52)).toStrictEqual("AZ");
13 | })
14 |
15 | test('Return KA if number is 287', () => {
16 | expect(to_spreadsheet_colname(287)).toStrictEqual("KA");
17 | })
18 |
19 | test('Return YYZ if number is 17576', () => {
20 | expect(to_spreadsheet_colname(17576)).toStrictEqual("YYZ");
21 | })
22 |
23 | test('Return DOJO if number is 80719', () => {
24 | expect(to_spreadsheet_colname(80719)).toStrictEqual("DOJO");
25 | })
26 |
27 | test('Return BECKY if number is 1004171', () => {
28 | expect(to_spreadsheet_colname(1004171)).toStrictEqual("BECKY");
29 | })
30 |
31 | test('Return TOOPS if number is 9413735', () => {
32 | expect(to_spreadsheet_colname(9413735)).toStrictEqual("TOOPS");
33 | })
34 |
--------------------------------------------------------------------------------
/challenges/2021-11-30-weird-column-naming/solutions/go/drkennetz/drkennetz.go:
--------------------------------------------------------------------------------
1 | package drkennetz
2 |
3 | import (
4 | "strings"
5 | )
6 |
7 | // Converts an input integer to a spreadsheet column name
8 | func ToSpreadsheetColName (integer int) string {
9 | quotient := integer
10 |
11 | var encoded []string
12 | for quotient > 0 {
13 | remainder := (quotient-1) % 26
14 | encoded = append(encoded, string(rune(remainder + 65)))
15 | quotient = (quotient-1) / 26
16 | }
17 | reverse(encoded)
18 | result := strings.Join(encoded, "")
19 | return result
20 | }
21 |
22 | // in place reversal of slice
23 | func reverse(s []string) []string {
24 | for i, j := 0, len(s) - 1; i < j; i, j = i+1, j-1 {
25 | s[i], s[j] = s[j], s[i]
26 | }
27 |
28 | return s
29 | }
30 |
31 |
--------------------------------------------------------------------------------
/challenges/2021-11-30-weird-column-naming/solutions/go/drkennetz/drkennetz_test.go:
--------------------------------------------------------------------------------
1 | package drkennetz
2 |
3 | import (
4 | "log"
5 | "testing"
6 | )
7 |
8 | func TestToSpreadsheetColName(t *testing.T) {
9 | tables := []struct {
10 | input int
11 | result string
12 | } {
13 | {1, "A"},
14 | {27, "AA"},
15 | {52, "AZ"},
16 | {287, "KA"},
17 | {17576, "YYZ"},
18 | {80719, "DOJO"},
19 | {1004171, "BECKY"},
20 | {9413735, "TOOPS"},
21 | }
22 |
23 | for _, table := range tables {
24 | actual := ToSpreadsheetColName(table.input)
25 | if actual != table.result{
26 | log.Fatalln("FAIL, expected: ", table.result, "got: ", actual)
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/challenges/2021-11-30-weird-column-naming/solutions/go/drkennetz/go.mod:
--------------------------------------------------------------------------------
1 | module drkennetz
2 |
3 | go 1.15
4 |
--------------------------------------------------------------------------------
/challenges/2021-11-30-weird-column-naming/solutions/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2021-11-30-weird-column-naming/solutions/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-01-18-planet-express/PlanetExpress.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/challenges/2022-01-18-planet-express/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/csharp/csharp-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2022-01-18-planet-express/solutions/csharp/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-01-18-planet-express/solutions/csharp/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-01-18-planet-express/solutions/go/drkennetz/drkennetz.go:
--------------------------------------------------------------------------------
1 | package drkennetz
2 |
3 | type Delivery struct {
4 | ID int
5 | Time int
6 | Status string
7 | }
8 |
9 |
10 | func CalcTime(deliveries []Delivery) int {
11 | if len(deliveries) == 0 {
12 | return 0
13 | }
14 | var pickup = make(map[int]int)
15 | var total = make(map[int]int)
16 | for _, delivery := range deliveries {
17 | if delivery.Status == "pickup" {
18 | pickup[delivery.ID] = delivery.Time
19 | } else if delivery.Status == "eaten" || delivery.Status == "dropoff" {
20 | total[delivery.ID] = total[delivery.ID] + (delivery.Time - pickup[delivery.ID])
21 | }
22 | }
23 | totalTime := 0
24 | for key := range total {
25 | totalTime += total[key]
26 | }
27 | return totalTime
28 | }
29 |
--------------------------------------------------------------------------------
/challenges/2022-01-18-planet-express/solutions/go/drkennetz/go.mod:
--------------------------------------------------------------------------------
1 | module drkennetz
2 |
3 | go 1.15
4 |
5 | require github.com/stretchr/testify v1.7.0
6 |
--------------------------------------------------------------------------------
/challenges/2022-01-18-planet-express/solutions/go/drkennetz/go.sum:
--------------------------------------------------------------------------------
1 | github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
2 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
4 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
6 | github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
7 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
8 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
9 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
10 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
11 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
12 |
--------------------------------------------------------------------------------
/challenges/2022-01-25-move-element-to-end/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/java/java-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2022-01-25-move-element-to-end/solutions/csharp/mrumiker/README.md:
--------------------------------------------------------------------------------
1 | # C# Solution for Move Element to End Problem
2 |
3 | ## Code Connector Coding Dojo January 25, 2022
4 |
5 | Requires Dotnet Core 6.0
6 |
7 | ---
8 |
9 | `Solution.cs` can be found in the src folder
10 |
11 | # To try it out:
12 |
13 | Switch to a new branch.
14 |
15 | Make sure you have Dotnet Core 6.0 installed
16 |
17 | Navigate to `test/MoveToEndChallenge.Tests` in your console.
18 |
19 | Type `dotnet test`
20 |
21 | ---
22 |
23 | Solution by [mrumiker](https://github.com/mrumiker)
24 |
--------------------------------------------------------------------------------
/challenges/2022-01-25-move-element-to-end/solutions/csharp/mrumiker/src/MoveToEndChallenge/MoveToEndChallenge.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net6.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/challenges/2022-01-25-move-element-to-end/solutions/csharp/mrumiker/src/MoveToEndChallenge/Program.cs:
--------------------------------------------------------------------------------
1 | // See https://aka.ms/new-console-template for more information
2 | Console.WriteLine("To test the function, type cd ../../test/MoveToEndChallengeTests in the console, then dotnet test.");
--------------------------------------------------------------------------------
/challenges/2022-01-25-move-element-to-end/solutions/csharp/mrumiker/src/MoveToEndChallenge/Solution.cs:
--------------------------------------------------------------------------------
1 | public class Solution
2 | {
3 | public static int[] MoveToEnd(int[] arr, int SpecialNum)
4 | {
5 |
6 | var StartIndex = 0;
7 | var EndIndex = FindEnd(arr.Length - 1); //the FindEnd function will set EndIndex to the last position containing a number that is not == SpecialNum
8 |
9 | while (StartIndex < EndIndex)
10 | {
11 | if (arr[StartIndex] == SpecialNum)//if we find a SpecialNum...
12 | {
13 | arr[StartIndex] = arr[EndIndex];
14 | arr[EndIndex] = SpecialNum;//switch the current instance of SpecialNum with the final non-special number in arr
15 | EndIndex = FindEnd(EndIndex); // run FindEnd to move EndIndex to the left until we reach the new final non-special number
16 | }
17 | StartIndex++;//always move StartIndex one to the right to continue the search
18 | }//if there is still daylight between StartIndex and EndIndex, keep going through the array!
19 |
20 | return arr;
21 |
22 | int FindEnd(int CurrentIndex)//returns the index of the last non-special number in the array
23 | {
24 | while (CurrentIndex > 0 && arr[CurrentIndex] == SpecialNum)//currentIndex > 0 prevents out of range exception if array contains all specialNums or is empty
25 | {
26 | CurrentIndex--;
27 | }
28 | return CurrentIndex;
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/challenges/2022-01-25-move-element-to-end/solutions/csharp/mrumiker/test/MoveToEndChallenge.Tests/MoveToEndChallenge.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | enable
6 |
7 | false
8 |
9 |
10 |
11 |
12 |
13 |
14 | runtime; build; native; contentfiles; analyzers; buildtransitive
15 | all
16 |
17 |
18 | runtime; build; native; contentfiles; analyzers; buildtransitive
19 | all
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/challenges/2022-02-01-greedy-goblin/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2022-02-01-greedy-goblin/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/javascript/js-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2022-02-01-greedy-goblin/solutions/javascript/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-02-01-greedy-goblin/solutions/javascript/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-02-09-simple-db/run-tests:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | python3 -m unittest solution.py
4 |
--------------------------------------------------------------------------------
/challenges/2022-02-09-simple-db/solutions/go/drkennetz/go.mod:
--------------------------------------------------------------------------------
1 | module simpledb
2 |
3 | go 1.19
4 |
5 | require (
6 | github.com/davecgh/go-spew v1.1.1 // indirect
7 | github.com/pmezard/go-difflib v1.0.0 // indirect
8 | github.com/stretchr/objx v0.4.0 // indirect
9 | github.com/stretchr/testify v1.8.0 // indirect
10 | gopkg.in/yaml.v3 v3.0.1 // indirect
11 | )
12 |
--------------------------------------------------------------------------------
/challenges/2022-02-09-simple-db/solutions/go/drkennetz/go.sum:
--------------------------------------------------------------------------------
1 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
5 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
6 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
7 | github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=
8 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
9 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
10 | github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
11 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
12 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
13 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
14 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
15 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
16 |
--------------------------------------------------------------------------------
/challenges/2022-02-14-three-number-sort/ThreeNumberSort.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/challenges/2022-02-14-three-number-sort/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/csharp/csharp-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2022-02-14-three-number-sort/solutions/csharp/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-02-14-three-number-sort/solutions/csharp/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-02-14-three-number-sort/solutions/csharp/mrumiker/mrumiker.cs:
--------------------------------------------------------------------------------
1 | public class ThreeNumberSort
2 | {
3 | public int[] SortArray(int[] input, (int, int, int) threes)
4 | {
5 | var FirstCount = 0;
6 | var SecondCount = 0;
7 | var ThirdCount = 0;
8 |
9 | (var FirstNum, var SecondNum, var ThirdNum) = threes;
10 |
11 | for (var i = 0; i < input.Length; i++)
12 | {
13 | var Num = input[i];
14 | if (Num == FirstNum)
15 | {
16 | if (i > FirstCount)
17 | {
18 | input[FirstCount] = FirstNum;
19 |
20 | if (SecondCount > 0)
21 | {
22 | input[FirstCount + SecondCount] = SecondNum;
23 | }
24 |
25 | if (ThirdCount > 0)
26 | {
27 | input[i] = ThirdNum;
28 | }
29 | }
30 | FirstCount++;
31 | }
32 | else if (Num == SecondNum)
33 | {
34 | if (i > FirstCount + SecondCount)
35 | {
36 | input[FirstCount + SecondCount] = SecondNum;
37 | input[i] = ThirdNum;
38 | }
39 | SecondCount++;
40 | }
41 | else
42 | {
43 | ThirdCount++;
44 | }
45 | }
46 | return input;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/challenges/2022-02-22-jump-around/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2022-02-22-jump-around/solution.js:
--------------------------------------------------------------------------------
1 | // # Jump Around
2 |
3 | // Starting from 0 on a number line, you would like to make a series of jumps that lead to the integer N. On the `i`th jump, you may move exactly `i` places to the left or right (1st jump -> 1 place, 2nd jump -> 2 places, etc.). Determine the smallest number of jumps needed to get from 0 to N.
4 |
5 | // ## Business Rules/Errata
6 |
7 | // - The number line should be assumed to extend infinitely in both directions. N may be either positive or negative.
8 | // - Keep in mind that you should identify the *number* of jumps, not the path. The result of your function should be a positive integer.
9 | // - There is no guarantee that all the jumps to reach a given number will be in the same direction.
10 | // - All test cases return an answer, you should assume that every number can be reached using this strategy.
11 |
12 | // ## Examples
13 |
14 | // This section should provide examples of expected inputs/outputs like so:
15 |
16 | // ```
17 | // jump_to(0) // 0: start at 0
18 | // jump_to(1) // 1: 0 -> 1
19 | // jump_to(2) // 3: 0 -> 1 -> -1 -> 2
20 | // jump_to(-2) // 3: 0 -> -1 -> 1 -> -2
21 | // jump_to(175) // 21
22 | // ```
23 |
24 | function jumpAround(input) {
25 |
26 | //type your solution here
27 |
28 | }
29 |
30 | module.exports = { jumpAround };
--------------------------------------------------------------------------------
/challenges/2022-02-22-jump-around/solution.test.js:
--------------------------------------------------------------------------------
1 | const { jumpAround } = require('./solution');
2 |
3 | test('returns zero when input is zero', () => {
4 | const num = 0;
5 | const actual = jumpAround(num);
6 | const expected = 0;
7 | expect(actual).toEqual(expected);
8 | });
9 |
10 | test('returns one when input is one', () => {
11 | const num = 1;
12 | const actual = jumpAround(num);
13 | const expected = 1;
14 | expect(actual).toEqual(expected);
15 | });
16 |
17 | test('returns correct number of jumps when one jump is backward', () => {
18 | const num = 2;
19 | const actual = jumpAround(num);
20 | const expected = 3;
21 | expect(actual).toEqual(expected);
22 | });
23 |
24 | test('returns correct number of jumps when input is negative', () => {
25 | const num = -2;
26 | const actual = jumpAround(num);
27 | const expected = 3;
28 | expect(actual).toEqual(expected);
29 | });
30 |
31 | test('returns correct number of jumps when more than one jump is backward', () => {
32 | const num = 175;
33 | const actual = jumpAround(num);
34 | const expected = 21;
35 | expect(actual).toEqual(expected);
36 | });
37 |
38 | // Only run this test if you're NOT trying to brute-force an answer
39 | // test('returns correct number of jumps when all jumps are forward', () => {
40 | // const num = -154290;
41 | // const actual = jumpAround(num);
42 | // const expected = 555;
43 | // expect(actual).toEqual(expected);
44 | // });
--------------------------------------------------------------------------------
/challenges/2022-03-01-longest-peak/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
--------------------------------------------------------------------------------
/challenges/2022-03-01-longest-peak/solutions/javascript/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-03-01-longest-peak/solutions/javascript/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-03-08-hidden-digits/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
--------------------------------------------------------------------------------
/challenges/2022-03-08-hidden-digits/solution.js:
--------------------------------------------------------------------------------
1 | // # Hidden Digits
2 |
3 | // You are given a string `time` in the form of `hh:mm`, where some of the digits in the string are _hidden_ (represented by `?`).
4 |
5 | // Return the _**LATEST valid time**_ you can get from `time` by replacing the hidden digits.
6 |
7 | // The valid times are those inclusively between `00:00` and `23:59`.
8 |
9 | // ## Business Rules/Errata
10 |
11 | // - `time` is a string in the format `hh:mm`
12 | // - It is guaranteed that you can produce a valid time from the given string.
13 | // - Your function should return a string.
14 |
15 | // ## Examples
16 |
17 | // ```
18 | // hiddenDigits("2?:?0") -> "23:50"
19 | // hiddenDigits("0?:3?") -> "09:39"
20 | // hiddenDigits("?7:?1") -> "17:51"
21 | // hiddenDigits("1?:22") -> "19:22"
22 | // hiddenDigits("00:00") -> "00:00"
23 | // hiddenDigits("??:??") -> "23:59"
24 | // ```
25 |
26 | // ## Tackling This Challenge
27 |
28 | function hiddenDigits(time) {
29 | //Type your solution here
30 | }
31 |
32 | module.exports = { hiddenDigits };
33 |
--------------------------------------------------------------------------------
/challenges/2022-03-08-hidden-digits/solutions/javascript/brehberg/brehberg.js:
--------------------------------------------------------------------------------
1 | // # Hidden Digits
2 | // You are given a string `time` in the form of `hh:mm`, where some of the digits in the string are _hidden_ (represented by `?`).
3 | // Return the _**LATEST valid time**_ you can get from `time` by replacing the hidden digits.
4 | // The valid times are those inclusively between `00:00` and `23:59`.
5 |
6 | function hiddenDigits(time) {
7 | return time
8 | .trim() // Time - ‘hh:mm’ - Hours and Minutes
9 | .replace(/^\?\?/, "23") // Hours: if both are “?” replace with ‘23’
10 | .replace(/^\?([0-4])/, "2$1") // If first is “?” and second is less than 4, first is ‘2’
11 | .replace(/^\?([5-9])/, "1$1") // If first is “?” and second is not less than 4, otherwith ‘1’
12 | .replace(/^([0-1])\?/, "$19") // If second is “?” and first is 0 or 1, second must be ‘9’
13 | .replace(/^(2)\?/, "23") // If second is "?" and first digit is 2, second must be ‘3’
14 | .replace(/:\?/, ":5") // Minutes: If first minutes digit is “?” - change to “5”
15 | .replace(/\?$/, "9"); // If second minutes digit is “?” - change to '9'
16 | }
17 |
18 | module.exports = { hiddenDigits };
19 |
--------------------------------------------------------------------------------
/challenges/2022-03-08-hidden-digits/solutions/javascript/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-03-08-hidden-digits/solutions/javascript/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-03-08-hidden-digits/solutions/python/xanderyzwich/xanderyzwich.py:
--------------------------------------------------------------------------------
1 | from unittest import TestCase
2 |
3 |
4 | def hidden_digits(time_str):
5 | result = ''
6 |
7 | # Hours
8 | first_hidden = '?' == time_str[0]
9 | second_hidden = '?' == time_str[1]
10 | if first_hidden and second_hidden:
11 | result += '23'
12 | else:
13 | if first_hidden:
14 | result += '2' if int(time_str[1]) < 5 else '1'
15 | else:
16 | result += time_str[0]
17 |
18 | if second_hidden:
19 | result += '3' if time_str[0] > '1' else '9'
20 | else:
21 | result += time_str[1]
22 |
23 | # Separator
24 | result += ':'
25 |
26 | # Minutes
27 | if '??' == time_str[3:]:
28 | result += '59'
29 | else:
30 | result += '5' if '?' == time_str[3] else time_str[3]
31 | result += '9' if '?' == time_str[4] else time_str[4]
32 | return result
33 |
34 |
35 | class TestHiddenDigits(TestCase):
36 | def test_this(self):
37 | assert hidden_digits("2?:?0") == "23:50"
38 | assert hidden_digits("0?:3?") == "09:39"
39 | assert hidden_digits("?7:?1") == "17:51"
40 | assert hidden_digits("1?:22") == "19:22"
41 | assert hidden_digits("00:00") == "00:00"
42 | assert hidden_digits("??:??") == "23:59"
43 |
--------------------------------------------------------------------------------
/challenges/2022-03-08-hidden-digits/solutions/rust/ericwburden/ericwburden.rs:
--------------------------------------------------------------------------------
1 | use std::iter::zip;
2 |
3 | #[allow(dead_code)]
4 | fn hidden_digits(s: &str) -> String {
5 | let time_in = s
6 | .chars()
7 | .filter(|c| *c != ':')
8 | .map(|c| c.to_digit(10))
9 | .collect::>();
10 | let mut max_vals = vec![2, 3, 5, 9];
11 | if let Some(h) = time_in[1] {
12 | if h > 3 { max_vals[0] = 1; }
13 | }
14 | if let Some(h) = time_in[0] {
15 | if h < 2 { max_vals[1] = 9; }
16 | }
17 |
18 | let out: Vec<_> = zip(time_in, max_vals)
19 | .map(|(a, b)| a.unwrap_or(b))
20 | .collect();
21 | format!("{}{}:{}{}", out[0], out[1], out[2], out[3])
22 | }
23 |
24 | #[cfg(test)]
25 | mod tests {
26 | use super::*;
27 |
28 | #[test]
29 | fn example_tests() {
30 | assert_eq!(hidden_digits("2?:?0"), String::from("23:50"));
31 | assert_eq!(hidden_digits("0?:3?"), String::from("09:39"));
32 | assert_eq!(hidden_digits("?7:?1"), String::from("17:51"));
33 | assert_eq!(hidden_digits("1?:22"), String::from("19:22"));
34 | assert_eq!(hidden_digits("00:00"), String::from("00:00"));
35 | assert_eq!(hidden_digits("??:??"), String::from("23:59"));
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/challenges/2022-03-15-longest-common-prefix/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
--------------------------------------------------------------------------------
/challenges/2022-03-15-longest-common-prefix/solution.js:
--------------------------------------------------------------------------------
1 | // # Longest Common Prefix
2 | //
3 | // Given a list of strings, return a string containing the longest prefix in
4 | // common amongst all the provided strings.
5 | //
6 | // ## Business Rules/Errata
7 | //
8 | // - Your input will be a list of strings, and will contain at least one string.
9 | // - Each string will contain one or more characters.
10 | // - Your function should return a string.
11 | // - In cases where no common prefix exists, return an empty string.
12 | //
13 | // ## Examples
14 | //
15 | // ```
16 | // strings = ["flower", "flowed", "flicker"]
17 | // longest_common_prefix(strings) // "fl"
18 | // ```
19 | //
20 | // ```
21 | // strings = ["pickle", "pickup", "pico", "picture"]
22 | // longest_common_prefix(strings) // "pic"
23 | // ```
24 | //
25 | // ```
26 | // strings = ["butcher", "baker", "candlestick maker"]
27 | // longest_common_prefix(strings) // ""
28 | // ```
29 |
30 | function longestCommonPrefix(strings) {
31 | //Type your solution here
32 | }
33 |
34 | module.exports = { longestCommonPrefix };
35 |
--------------------------------------------------------------------------------
/challenges/2022-03-15-longest-common-prefix/solutions/javascript/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-03-15-longest-common-prefix/solutions/javascript/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-03-29-search-party/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
--------------------------------------------------------------------------------
/challenges/2022-03-29-search-party/solutions/javascript/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-03-29-search-party/solutions/javascript/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-04-05-pascals-triangle/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2022-04-05-pascals-triangle/solutions/javascript/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-04-05-pascals-triangle/solutions/javascript/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-04-12-skip-counting/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/java/java-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2022-04-12-skip-counting/solutions/java/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-04-12-skip-counting/solutions/java/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-04-12-skip-counting/solutions/javascript/matthewfee/solution.js:
--------------------------------------------------------------------------------
1 | const skipCounting = (playerCount, tileCount) => {
2 | if (tileCount === 0) {
3 | return 0
4 | }
5 | // generate the board state
6 |
7 | let currentTile = 0
8 | let tiles = []
9 | let currentPlayer = 0
10 |
11 | while (currentTile < tileCount) {
12 | let firstValue = tiles[0]
13 |
14 | if (tiles.length >= 1) {
15 | tiles.shift()
16 | tiles.push(firstValue)
17 | }
18 |
19 | tiles.push([currentTile, currentPlayer])
20 |
21 | currentTile++
22 | currentPlayer++
23 |
24 | //return to first player at end of last player's turn
25 |
26 | if (currentPlayer >= playerCount) {
27 | currentPlayer = 0
28 | }
29 | }
30 |
31 | //rotate tiles if needed
32 |
33 | while (tiles[0][0] !== 0 || tiles[0][1] !== 0) {
34 | tiles.push(tiles[0])
35 | tiles.shift()
36 | }
37 |
38 | // calculate score
39 |
40 | let playerScores = new Array(playerCount).fill(0)
41 |
42 | for (let i = 0; i < tiles.length; i++) {
43 | let value = tiles[i][0]
44 | let player = tiles[i][1]
45 | let score = i * value
46 |
47 | playerScores[player] += score
48 | }
49 |
50 | const maxScore = playerScores.reduce((a, b) => {
51 | return Math.max(a, b)
52 | })
53 |
54 | return maxScore
55 | }
56 |
--------------------------------------------------------------------------------
/challenges/2022-04-12-skip-counting/solutions/javascript/saimaheshtaduri/solution.js:
--------------------------------------------------------------------------------
1 | const skipCounting = (playerCount, tileCount) => {
2 |
3 | let last_tile_index = 0;
4 | let last_tile = 0;
5 |
6 | let result = [ 0 ];
7 | let scores = new Array(playerCount).fill(0);
8 |
9 | for(let r = 1; r < tileCount; r++){
10 | const new_index = (last_tile_index + 2) % r;
11 | if(new_index == 0){
12 | result.push(++last_tile);
13 | last_tile_index = result.length - 1;
14 | }else{
15 | result.splice(new_index,0,++last_tile);
16 | last_tile_index = new_index;
17 | }
18 |
19 | }
20 |
21 | result.forEach((val, ind) => {
22 | const player = val%playerCount;
23 | scores[player] += (val * ind);
24 | })
25 |
26 | return Math.max(...scores);
27 |
28 | }
--------------------------------------------------------------------------------
/challenges/2022-04-19-intro-to-advent-of-code/aoc_2019_01/Manifest.toml:
--------------------------------------------------------------------------------
1 | # This file is machine-generated - editing it directly is not advised
2 |
3 | julia_version = "1.7.2"
4 | manifest_format = "2.0"
5 |
6 | [[deps.Base64]]
7 | uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
8 |
9 | [[deps.InteractiveUtils]]
10 | deps = ["Markdown"]
11 | uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
12 |
13 | [[deps.Logging]]
14 | uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
15 |
16 | [[deps.Markdown]]
17 | deps = ["Base64"]
18 | uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
19 |
20 | [[deps.Random]]
21 | deps = ["SHA", "Serialization"]
22 | uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
23 |
24 | [[deps.SHA]]
25 | uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
26 |
27 | [[deps.Serialization]]
28 | uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
29 |
30 | [[deps.Test]]
31 | deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
32 | uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
33 |
--------------------------------------------------------------------------------
/challenges/2022-04-19-intro-to-advent-of-code/aoc_2019_01/Project.toml:
--------------------------------------------------------------------------------
1 | name = "aoc_2019_01"
2 | uuid = "3d7f99c6-57d3-4a8d-9821-cf8788025b83"
3 | authors = ["Eric Burden "]
4 | version = "0.1.0"
5 |
6 | [deps]
7 | Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
8 |
--------------------------------------------------------------------------------
/challenges/2022-04-19-intro-to-advent-of-code/aoc_2019_01/src/aoc_2019_01.jl:
--------------------------------------------------------------------------------
1 | module aoc_2019_01
2 |
3 | ingest(path) = [parse(Int, l) for l in readlines(path)]
4 |
5 | function calculate_fuel_cost(mass)
6 | return (mass ÷ 3) - 2
7 | end
8 |
9 | function calculate_fuel_cost_recursive(mass)
10 | fuel = (mass ÷ 3) - 2
11 | fuel > 0 || return 0
12 | return fuel + calculate_fuel_cost_recursive(fuel)
13 | end
14 |
15 | function solve(path, calculator)
16 | input_values = ingest(path)
17 | return sum(calculator(m) for m in input_values)
18 | end
19 |
20 | solve_part_one(path) = solve(path, calculate_fuel_cost)
21 | solve_part_two(path) = solve(path, calculate_fuel_cost_recursive)
22 |
23 | end # module
24 |
--------------------------------------------------------------------------------
/challenges/2022-04-19-intro-to-advent-of-code/aoc_2019_01/test/runtests.jl:
--------------------------------------------------------------------------------
1 | using Test;
2 | using aoc_2019_01;
3 |
4 | @testset "Should correctly calculate part one per-module cost" begin
5 | calculate = aoc_2019_01.calculate_fuel_cost
6 |
7 | example_one = calculate(12)
8 | @test example_one == 2
9 |
10 | example_two = calculate(14)
11 | @test example_two == 2
12 |
13 | example_three = calculate(1969)
14 | @test example_three == 654
15 |
16 | example_four = calculate(100756)
17 | @test example_four == 33583
18 | end
19 |
20 | @testset "Should correctly solve part one" begin
21 | solve = aoc_2019_01.solve_part_one
22 | answer = solve("../src/input.txt")
23 | @test answer == 3_393_938
24 | end
25 |
26 | @testset "Should correctly calculate part two per-module cost" begin
27 | calculate = aoc_2019_01.calculate_fuel_cost_recursive
28 |
29 | example_one = calculate(14)
30 | @test example_one == 2
31 |
32 | example_two = calculate(1969)
33 | @test example_two == 966
34 |
35 | example_three = calculate(100_756)
36 | @test example_three == 50_346
37 | end
38 |
39 | @testset "Should correctly solve part two" begin
40 | solve = aoc_2019_01.solve_part_two
41 | answer = solve("../src/input.txt")
42 | @test answer == 5_088_037
43 | end
44 |
--------------------------------------------------------------------------------
/challenges/2022-04-26-dojo-anniversary-edition/javascript/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2022-04-26-dojo-anniversary-edition/julia/Manifest.toml:
--------------------------------------------------------------------------------
1 | # This file is machine-generated - editing it directly is not advised
2 |
3 | julia_version = "1.7.2"
4 | manifest_format = "2.0"
5 |
6 | [[deps.Base64]]
7 | uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
8 |
9 | [[deps.InteractiveUtils]]
10 | deps = ["Markdown"]
11 | uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
12 |
13 | [[deps.Logging]]
14 | uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
15 |
16 | [[deps.Markdown]]
17 | deps = ["Base64"]
18 | uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
19 |
20 | [[deps.Random]]
21 | deps = ["SHA", "Serialization"]
22 | uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
23 |
24 | [[deps.SHA]]
25 | uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
26 |
27 | [[deps.Serialization]]
28 | uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
29 |
30 | [[deps.Test]]
31 | deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
32 | uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
33 |
--------------------------------------------------------------------------------
/challenges/2022-04-26-dojo-anniversary-edition/julia/Project.toml:
--------------------------------------------------------------------------------
1 | name = "julia"
2 | uuid = "1cd9fe4f-12e7-416c-96b3-4d0d30c148a1"
3 | authors = ["Eric Burden "]
4 | version = "0.1.0"
5 |
6 | [deps]
7 | Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
8 |
--------------------------------------------------------------------------------
/challenges/2022-04-26-dojo-anniversary-edition/julia/README.md:
--------------------------------------------------------------------------------
1 | # Tackling This Challenge
2 |
3 | 1. Make sure you've got the required software on your machine: Julia 1.7+
4 | 2. If you haven't already, fork the CodingDojo repository ([INSTRUCTIONS](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo)) and check out a working branch.
5 | 3. Modify the `src/julia.jl` file in this folder to solve the puzzle(s)!
6 | 4. Run the tests to check your solution by navigating to this directory and running `julia julia.jl`. Tests will stop running on the first failure.
7 | 5. When you're ready, copy the `julia.jl` file to 'solutions/julia/.jl'.
8 | 6. Commit _just your solutions file_ and submit your pull request. If you need some help with that, see [this solutions guide in our wiki](https://github.com/codeconnector/CodingDojo/wiki#solutions).
9 |
10 | ## Requirements
11 |
12 | - Julia 1.7+
13 |
--------------------------------------------------------------------------------
/challenges/2022-04-26-dojo-anniversary-edition/rust/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "rust"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | [dependencies]
7 |
--------------------------------------------------------------------------------
/challenges/2022-04-26-dojo-anniversary-edition/rust/README.md:
--------------------------------------------------------------------------------
1 | # Tackling This Challenge
2 |
3 | 1. Make sure you've got the required software on your machine: Rust 2021 edition
4 | 2. If you haven't already, fork the CodingDojo repository ([INSTRUCTIONS](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo)) and check out a working branch.
5 | 3. Modify the `src/lib.rs` file in this folder to solve the puzzle(s)!
6 | 4. Run the tests to check your solution by navigating to this directory and running `cargo test`.
7 | 5. When you're ready, copy the `lib.rs` file to 'solutions/rust/.rs'.
8 | 6. Commit _just your solutions file_ and submit your pull request. If you need some help with that, see [this solutions guide in our wiki](https://github.com/codeconnector/CodingDojo/wiki#solutions).
9 |
10 | ## Requirements
11 |
12 | - Rust 2021 edition
13 |
--------------------------------------------------------------------------------
/challenges/2022-04-26-dojo-anniversary-edition/solutions/javascript/.placeholder:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/challenges/2022-04-26-dojo-anniversary-edition/solutions/javascript/dekotanelson/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2022-04-26-dojo-anniversary-edition/solutions/julia/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-04-26-dojo-anniversary-edition/solutions/julia/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-04-26-dojo-anniversary-edition/solutions/rust/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-04-26-dojo-anniversary-edition/solutions/rust/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-06-14-two-sum-numbers/TwoSumNumbers.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/challenges/2022-06-14-two-sum-numbers/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/csharp/csharp-test-runner.sh
2 |
--------------------------------------------------------------------------------
/challenges/2022-06-14-two-sum-numbers/solutions/csharp/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-06-14-two-sum-numbers/solutions/csharp/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-06-14-two-sum-numbers/solutions/csharp/mob/mob.cs:
--------------------------------------------------------------------------------
1 | using Xunit;
2 | using System.Collections.Generic;
3 |
4 | public class TwoSumNumbers
5 | {
6 | public bool DoesItSum(int sum, int[] numbers)
7 | {
8 | var hashset = new HashSet();
9 | for (int i = 0; i < numbers.Length; i++)
10 | {
11 | var x = sum - numbers[i];
12 | if (hashset.Contains(x))
13 | {
14 | return true;
15 | }
16 | hashset.Add(numbers[i]);
17 | }
18 | return false;
19 | }
20 | }
--------------------------------------------------------------------------------
/challenges/2022-07-12-node-depths/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/java/java-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2022-07-12-node-depths/solutions/go/drkennetz/go.mod:
--------------------------------------------------------------------------------
1 | module drkennetz
2 |
3 | go 1.15
4 |
5 | require github.com/stretchr/testify v1.8.0
6 |
--------------------------------------------------------------------------------
/challenges/2022-07-12-node-depths/solutions/go/drkennetz/go.sum:
--------------------------------------------------------------------------------
1 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
5 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
6 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
7 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
8 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
9 | github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
10 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
11 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
12 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
13 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
14 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
15 |
--------------------------------------------------------------------------------
/challenges/2022-07-12-node-depths/solutions/go/drkennetz/nodeDepths.go:
--------------------------------------------------------------------------------
1 | package drkennetz
2 |
3 | type BinaryTree struct {
4 | value int
5 | left *BinaryTree
6 | right *BinaryTree
7 | }
8 |
9 | func NodeDepths(root *BinaryTree) int {
10 | return nodeDepthsHelper(root, 0)
11 | }
12 |
13 | func nodeDepthsHelper(root *BinaryTree, depth int) int {
14 | if root == nil {
15 | return 0
16 | }
17 | return depth + nodeDepthsHelper(root.left, depth+1) + nodeDepthsHelper(root.right, depth+1)
18 | }
19 |
--------------------------------------------------------------------------------
/challenges/2022-07-12-node-depths/solutions/java/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-07-12-node-depths/solutions/java/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-08-09-critter-crossing/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/java/java-test-runner.sh
--------------------------------------------------------------------------------
/challenges/2022-08-09-critter-crossing/solutions/java/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-08-09-critter-crossing/solutions/java/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-08-09-critter-crossing/solutions/python/Moses-Alero/critterCrossing.py:
--------------------------------------------------------------------------------
1 | def find_crossroads(input):
2 | rowsDict = {}
3 | columnsDict = {}
4 | cross_roads = []
5 |
6 |
7 | for point in input:
8 | row = point[0]
9 | column = point[1]
10 |
11 | #count and increment recurring longitude and latitude values
12 | rowsDict[row] = rowsDict[row] + 1 if(row in rowsDict.keys()) else 1
13 | columnsDict[column] = columnsDict[column] + 1 if(column in columnsDict.keys()) else 1
14 |
15 | #find and return intersections
16 | for _row in rowsDict:
17 | if(rowsDict[_row] > 1):
18 | for _column in columnsDict:
19 | if(columnsDict[_column] > 1):
20 | cross_roads.append(tuple((_row,_column)))
21 | else:
22 | continue
23 | else:
24 | continue
25 |
26 | return cross_roads
27 |
28 |
--------------------------------------------------------------------------------
/challenges/2022-09-12-find-those-fives/setups/javascript/info.md:
--------------------------------------------------------------------------------
1 | # Running the Tests
2 |
3 | Navigate to this directory and run `npm install` to initialize the project.
4 | Run the tests to check your solution by navigating to this directory and running `npm test`.
5 |
6 | # Requirements
7 |
8 | - npm 7.9.0+
9 |
--------------------------------------------------------------------------------
/challenges/2022-09-12-find-those-fives/setups/javascript/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2022-09-12-find-those-fives/setups/javascript/solution.test.js:
--------------------------------------------------------------------------------
1 | const { findThoseFives } = require("./solution");
2 |
3 | test("Test Case One", () => {
4 | const input1 = 1;
5 | const input2 = 10;
6 | const actual = findThoseFives(input1, input2);
7 | const expected = 1;
8 | expect(actual).toEqual(expected);
9 | });
10 |
11 | test("Test Case Two", () => {
12 | const input1 = 50;
13 | const input2 = 60;
14 | const actual = findThoseFives(input1, input2);
15 | const expected = 11;
16 | expect(expected).toEqual(actual);
17 | });
18 |
19 | test("Test Case Three", () => {
20 | const input1 = -6;
21 | const input2 = 6;
22 | const actual = findThoseFives(input1, input2);
23 | const expected = 2;
24 | expect(expected).toEqual(actual);
25 | });
26 |
27 | test("Test Case Four", () => {
28 | const input1 = -15;
29 | const input2 = -5;
30 | const actual = findThoseFives(input1, input2);
31 | const expected = 2;
32 | expect(expected).toEqual(actual);
33 | });
34 |
--------------------------------------------------------------------------------
/challenges/2022-09-12-find-those-fives/solutions/julia/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-09-12-find-those-fives/solutions/julia/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-09-12-find-those-fives/solutions/julia/mob/reasoning.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-09-12-find-those-fives/solutions/julia/mob/reasoning.pdf
--------------------------------------------------------------------------------
/challenges/2022-09-12-find-those-fives/test.jl:
--------------------------------------------------------------------------------
1 | using Pkg; Pkg.add("Test")
2 | using Test
3 |
4 | include("solution.jl")
5 |
6 | @testset "Can count fives in simple cases" begin
7 | @test find_those_fives(0, 10) == 1
8 | @test find_those_fives(0, 20) == 2
9 | @test find_those_fives(0, 54) == 10
10 | end
11 |
12 | @testset "Can count fives when duplicates happen" begin
13 | @test find_those_fives(0, 60) == 16
14 | @test find_those_fives(0, 600) == 220
15 | @test find_those_fives(0, 7777) == 3358
16 | end
17 |
18 | @testset "Can count fives in arbitrary positive ranges" begin
19 | @test find_those_fives(123, 7777) == 3336
20 | @test find_those_fives(50000, 900000) == 530000
21 | @test find_those_fives(321, 654) == 168
22 | end
23 |
24 | @testset "Can count fives in negative ranges" begin
25 | @test find_those_fives(-10, 10) == 2
26 | @test find_those_fives(-100, 100) == 40
27 | @test find_those_fives(-456, 789) == 352
28 | @test find_those_fives(-750, -325) == 184
29 | end
30 |
31 | @testset "Can count fives in large ranges" begin
32 | @test find_those_fives(0, 987654321) == 891625584
33 | @test find_those_fives(-123456789, 0) == 96029849
34 | @test find_those_fives(-123456789, 987654321) == 987655433
35 | end
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/challenge.md:
--------------------------------------------------------------------------------
1 | # Find Three Largest Numbers
2 |
3 | Write a function that takes in an array of at least three integers and, without sorting the input array, returns a sorted array of the three largest integers in the input array. The function should return duplicate integers if necessary.
4 |
5 | ## Business Rules/Errata
6 |
7 | - The input array should have at least three integers. If it does not, you should return a null value.
8 | - You may not sort the input array
9 | - The function should handle duplicate integers; for example `[10, 5, 9, 10, 12]` should return `[10, 10, 12]`
10 | - Constant space -> you will return a new array of 3 integers, and this will be the only new data structure you create.
11 | - Linear time -> you should solve this problem by only passing through the array a single time.
12 |
13 | ## Examples
14 |
15 | ```
16 | findThreeLargestNumbers([141, 1, 17, -7, -17, -27, 18, 541, 8, 7, 7]) -> [18, 141, 541]
17 | findThreeLargestNumbers([11, -7, 5]) -> [-7, 5, 11]
18 | findThreeLargestNumbers([1]) -> Null
19 | ```
20 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/csharp/BlastfromthePast.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/csharp/info.md:
--------------------------------------------------------------------------------
1 | ## IMPORTANT NOTE
2 |
3 | If your input array has a length of less than 3, your solution should return an EMPTY ARRAY instead of null. We made this change because of the strict typing restrictions of the language.
4 |
5 | ### Tackling This Challenge in C#
6 | 1. Make sure you've got the required software on your machine: [.NET Core 3.0+](https://dotnet.microsoft.com/download) and a text editor.
7 | 2. If you haven't already, fork the CodingDojo repository ([INSTRUCTIONS](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo)).
8 | 3. Enter your solution code in the `BlastFromthePast.cs` file
9 | 4. Run the tests to check your solution by navigating to this directory and running `./run-tests` or `dotnet test`.
10 | 5. Submit your solution to the repo using [this solutions guide in our wiki](https://github.com/codeconnector/CodingDojo/wiki#solutions).
11 |
12 |
13 | ### Requirements
14 |
15 | - .NET Core 3.0+
16 |
17 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/csharp/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/csharp/csharp-test-runner.sh
2 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/go/go.mod:
--------------------------------------------------------------------------------
1 | module solution
2 |
3 | go 1.19
4 |
5 | require (
6 | github.com/davecgh/go-spew v1.1.1 // indirect
7 | github.com/pmezard/go-difflib v1.0.0 // indirect
8 | github.com/stretchr/testify v1.8.0 // indirect
9 | gopkg.in/yaml.v3 v3.0.1 // indirect
10 | )
11 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/go/go.sum:
--------------------------------------------------------------------------------
1 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
5 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
6 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
7 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
8 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
9 | github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
10 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
11 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
12 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
13 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
14 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
15 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/go/info.md:
--------------------------------------------------------------------------------
1 | # Running Tests
2 |
3 | First, import the package used by tests:
4 | ```shell
5 | go mod tidy
6 | ```
7 | Then, run the tests to check your solution by running:
8 | ```shell
9 | go test .
10 | ```
11 |
12 | # Requirements
13 | - go 1.15+
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/go/solution.go:
--------------------------------------------------------------------------------
1 | // Package solution solves the blast from the past challenge
2 | package solution
3 |
4 | /*
5 | # Find Three Largest Numbers
6 |
7 | Write a function that takes in an array of at least three integers and, without
8 | sorting the input array, returns a sorted array of the three largest integers in
9 | the input array. The function should return duplicate integers if necessary.
10 |
11 | ## Business Rules/Errata
12 | - The input array should have at least three integers. If it does not, you should
13 | return a null value.
14 | - You may not sort the input array
15 | - The function should handle duplicate integers; for example `[10, 5, 9, 10, 12]`
16 | should return `[10, 10, 12]`
17 | - Constant space -> you will return a new array of 3 integers, and this will be the
18 | only new data structure you create.
19 | - Linear time -> you should solve this problem by only passing through the array a
20 | single time.
21 | */
22 |
23 | func Solution(array []int) []int {
24 | // Your code goes here
25 | return nil
26 | }
27 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/go/solution_test.go:
--------------------------------------------------------------------------------
1 | package solution
2 |
3 | import (
4 | "github.com/stretchr/testify/require"
5 | "testing"
6 | )
7 |
8 | func TestSolution(t *testing.T) {
9 | testCases := []struct {
10 | input []int
11 | result []int
12 | }{
13 | {input: []int{141, 2, 17, -7, -17, -27, 18, 541, 8, 7, 7}, result: []int{18, 141, 541}},
14 | {input: []int{11, -7, 5, -7}, result: []int{-7, 5, 11}},
15 | {input: []int{1}, result: nil},
16 | }
17 |
18 | for _, v := range testCases {
19 | require.Equal(t, v.result, Solution(v.input))
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/java/info.md:
--------------------------------------------------------------------------------
1 | # Running Tests
2 |
3 | Run the tests to check your solution by navigating to this directory and running `./run-tests`.
4 |
5 | # Requirements
6 |
7 | - JDK 11+
8 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/javascript/info.md:
--------------------------------------------------------------------------------
1 | # Running the Tests
2 |
3 | Navigate to this directory and run `npm install` to initialize the project.
4 | Run the tests to check your solution by navigating to this directory and running `npm test`.
5 |
6 | # Requirements
7 |
8 | - npm 7.9.0+
9 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/javascript/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/javascript/solution.js:
--------------------------------------------------------------------------------
1 | // # Find Three Largest Numbers
2 | //
3 | // Write a function that takes in an array of at least three integers and, without
4 | // sorting the input array, returns a sorted array of the three largest integers in
5 | // the input array. The function should return duplicate integers if necessary.
6 | //
7 | // ## Business Rules/Errata
8 | //
9 | // - The input array should have at least three integers. If it does not, you should
10 | // return a null value.
11 | // - You may not sort the input array
12 | // - The function should handle duplicate integers; for example `[10, 5, 9, 10, 12]`
13 | // should return `[10, 10, 12]`
14 | // - Constant space -> you will return a new array of 3 integers, and this will be the
15 | // only new data structure you create.
16 | // - Linear time -> you should solve this problem by only passing through the array a
17 | // single time.
18 |
19 | function findThreeLargestNumbers(arr) {
20 | // type your solution here
21 | }
22 |
23 | module.exports = { findThreeLargestNumbers };
24 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/javascript/solution.test.js:
--------------------------------------------------------------------------------
1 | const { findThreeLargestNumbers } = require("./solution");
2 |
3 | test("Test Case One", () => {
4 | const input = [141, 2, 17, -7, -17, -27, 18, 541, 8, 7, 7];
5 | const actual = findThreeLargestNumbers(input);
6 | const expected = [18, 141, 541];
7 | expect(expected.length).toEqual(actual.length);
8 | expect(expected.every((num, index) => num === actual[index])).toBe(true);
9 | });
10 |
11 | test("Test Case Two", () => {
12 | const input = [11, -7, 5, -7];
13 | const actual = findThreeLargestNumbers(input);
14 | const expected = [-7, 5, 11];
15 | expect(expected.length).toEqual(actual.length);
16 | expect(expected.every((num, index) => num === actual[index])).toBe(true);
17 | });
18 |
19 | test("Test Case Three", () => {
20 | const input = [1];
21 | const actual = findThreeLargestNumbers(input);
22 | expect(actual).toBeNull();
23 | });
24 |
25 | test("Boundary value test for input length", () => {
26 | const input = [1, 1];
27 | const actual = findThreeLargestNumbers(input);
28 | expect(actual).toBeNull();
29 | });
30 |
31 | test("Exception test for no input array given", () => {
32 | const input = null;
33 | const actual = findThreeLargestNumbers(input);
34 | expect(actual).toBeNull();
35 | });
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/julia/info.md:
--------------------------------------------------------------------------------
1 | ## Running the Tests
2 |
3 | Install Julia using the instructions found [here](https://julialang.org/downloads/).
4 | Run tests with `julia solution.jl`.
5 |
6 | ## Requirements
7 |
8 | - Julia 1.7+
9 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/kotlin/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | build
3 | test_report.html
4 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/kotlin/build.gradle.kts:
--------------------------------------------------------------------------------
1 | import org.gradle.api.tasks.testing.logging.TestExceptionFormat
2 |
3 | plugins {
4 | kotlin("jvm") version "1.3.60"
5 | }
6 |
7 | repositories {
8 | jcenter()
9 | }
10 |
11 | dependencies {
12 | compile(kotlin("stdlib"))
13 |
14 | testImplementation("junit:junit:4.12")
15 | testImplementation(kotlin("test-junit"))
16 | }
17 |
18 | tasks.withType {
19 | testLogging {
20 | exceptionFormat = TestExceptionFormat.FULL
21 | events("passed", "failed", "skipped")
22 | }
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/kotlin/info.md:
--------------------------------------------------------------------------------
1 | # Running the Tests
2 |
3 | Execute the `run_tests` script once to set up Gradle for this challenge (use `./run_tests` from the challenge root directory).
4 | Confirm your solution by running tests. Execute the `run_tests` script to run the tests.
5 |
6 | ## Requirements
7 |
8 | - JDK 11+
9 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/kotlin/run_tests:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ../../../../resources/kotlin/gradlew test --info
4 | ln -s build/reports/tests/test/index.html test_report.html
5 | echo "You can also view test results in the 'test_report.html' file."
6 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/kotlin/src/main/kotlin/Solution.kt:
--------------------------------------------------------------------------------
1 | // # Find Three Largest Numbers
2 | //
3 | // Write a function that takes in an array of at least three integers and, without
4 | // sorting the input array, returns a sorted array of the three largest integers in
5 | // the input array. The function should return duplicate integers if necessary.
6 | //
7 | // ## Business Rules/Errata
8 | //
9 | // - The input array should have at least three integers. If it does not, you should
10 | // return a null value.
11 | // - You may not sort the input array
12 | // - The function should handle duplicate integers; for example `[10, 5, 9, 10, 12]`
13 | // should return `[10, 10, 12]`
14 | // - Constant space -> you will return a new array of 3 integers, and this will be the
15 | // only new data structure you create.
16 | // - Linear time -> you should solve this problem by only passing through the array a
17 | // single time.
18 |
19 | fun findThreeLargestNumbers(arr: IntArray): IntArray? {
20 | // Insert code here to solve the challenge
21 | // return intArrayOf(0, 0, 0)
22 | return null
23 | }
24 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/kotlin/src/test/kotlin/SolutionTest.kt:
--------------------------------------------------------------------------------
1 | import org.junit.Test
2 | import kotlin.test.assert
3 | import kotlin.test.assertNull
4 |
5 | class SolutionTest {
6 |
7 | @Test
8 | fun testCaseOne() {
9 | val input: IntArray = intArrayOf(141, 2, 17, -7, -17, -27, 18, 541, 8, 7, 7)
10 | val result: IntArray? = findThreeLargestNumbers(input)
11 | val expected: IntArray = intArrayOf(18, 141, 541)
12 | assert(result!! contentEquals expected)
13 | }
14 |
15 | @Test
16 | fun testCaseTwo() {
17 | val input: IntArray = intArrayOf(11, -7, 5, -7)
18 | val result: IntArray? = findThreeLargestNumbers(input)
19 | val expected: IntArray = intArrayOf(-7, 5, 11)
20 | assert(result!! contentEquals expected)
21 | }
22 |
23 | @Test
24 | fun testCaseThree() {
25 | val input: IntArray = intArrayOf(1)
26 | val result: IntArray? = findThreeLargestNumbers(input)
27 | assertNull(result)
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/python/info.md:
--------------------------------------------------------------------------------
1 | # Running Tests
2 |
3 | Run tests simply using the following:
4 | ```shell
5 | python -m unittest solution.py
6 | ```
7 |
8 | # Requirements
9 | - python >= 3.6
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/ruby/info.md:
--------------------------------------------------------------------------------
1 | # Running Tests
2 |
3 | Run the tests to check your solution by navigating to this directory and running `ruby solution.rb`.
4 |
5 | # Requirements
6 |
7 | - [Ruby 2.7+](https://www.ruby-lang.org/en/downloads/)
8 | - Rspec (Test Runner)
9 | - `gem install rspec`
10 | - `gem install rspec --user-install` (depending on system permissions)
11 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/rust/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "rust"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7 |
8 | [dependencies]
9 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/setups/rust/info.md:
--------------------------------------------------------------------------------
1 | ## Running the Tests
2 |
3 | Run tests by navigating to this directory and running `cargo test`.
4 |
5 | ## Requirements
6 |
7 | Rust 2021 edition or newer
8 |
9 | Can be installed via [rustup](https://rustup.rs/)
10 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/solutions/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-10-11-blast-from-the-past/solutions/.placeholder
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/solutions/csharp/mrumiker/mrumiker.cs:
--------------------------------------------------------------------------------
1 | using Xunit;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 |
6 | public class BlastfromthePast
7 | {
8 | public int[] FindThreeLargestNums(int[] input)
9 |
10 | {
11 | var inputLength = input.Length;
12 | if (inputLength < 3) return new int[] { };
13 |
14 | var output = new int[3];
15 | Array.Copy(input, output, 3); // copy the first three numbers in our array into our output array
16 | Array.Sort(output);
17 | for (int i = 3; i < inputLength; i++)
18 | {
19 | var currentNum = input[i];
20 | var currentLow = output[0];
21 | if (currentNum > currentLow)
22 | {
23 | output[0] = currentNum;
24 | Array.Sort(output);
25 | }
26 | }
27 |
28 | return output;
29 |
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/solutions/go/drkennetz/go.mod:
--------------------------------------------------------------------------------
1 | module solution
2 |
3 | go 1.19
4 |
5 | require (
6 | github.com/davecgh/go-spew v1.1.1 // indirect
7 | github.com/pmezard/go-difflib v1.0.0 // indirect
8 | github.com/stretchr/testify v1.8.0 // indirect
9 | gopkg.in/yaml.v3 v3.0.1 // indirect
10 | )
11 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/solutions/go/drkennetz/go.sum:
--------------------------------------------------------------------------------
1 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
5 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
6 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
7 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
8 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
9 | github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
10 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
11 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
12 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
13 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
14 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
15 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/solutions/go/drkennetz/solution_test.go:
--------------------------------------------------------------------------------
1 | package solution
2 |
3 | import (
4 | "github.com/stretchr/testify/require"
5 | "testing"
6 | )
7 |
8 | func TestSolution(t *testing.T) {
9 | testCases := []struct {
10 | input []int
11 | result []int
12 | }{
13 | {input: []int{141, 2, 17, -7, -17, -27, 18, 541, 8, 7, 7}, result: []int{18, 141, 541}},
14 | {input: []int{11, -7, 5, -7}, result: []int{-7, 5, 11}},
15 | {input: []int{1}, result: nil},
16 | }
17 |
18 | for _, v := range testCases {
19 | require.Equal(t, v.result, Solution(v.input))
20 | }
21 | }
22 |
23 | func TestSolutionSort(t *testing.T) {
24 | testCases := []struct {
25 | input []int
26 | result []int
27 | }{
28 | {input: []int{141, 2, 17, -7, -17, -27, 18, 541, 8, 7, 7}, result: []int{18, 141, 541}},
29 | {input: []int{11, -7, 5, -7}, result: []int{-7, 5, 11}},
30 | {input: []int{1}, result: nil},
31 | }
32 |
33 | for _, v := range testCases {
34 | require.Equal(t, v.result, SolutionSort(v.input))
35 | }
36 | }
37 |
38 | func BenchmarkSolution(b *testing.B) {
39 | for n := 0; n < b.N; n++ {
40 | Solution([]int{141, 2, 17, -7, -17, -27, 18, 541, 8, 7, 7})
41 | }
42 | }
43 |
44 | func BenchmarkSolutionSort(b *testing.B) {
45 | for n := 0; n < b.N; n++ {
46 | SolutionSort([]int{141, 2, 17, -7, -17, -27, 18, 541, 8, 7, 7})
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/solutions/javascript/moses-alero/info.md:
--------------------------------------------------------------------------------
1 | # Running the Tests
2 |
3 | Navigate to this directory and run `npm install` to initialize the project.
4 | Run the tests to check your solution by navigating to this directory and running `npm test`.
5 |
6 | # Requirements
7 |
8 | - npm 7.9.0+
9 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/solutions/javascript/moses-alero/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2022-10-11-blast-from-the-past/solutions/javascript/moses-alero/solution.test.js:
--------------------------------------------------------------------------------
1 | const { findThreeLargestNumbers } = require("./solution");
2 |
3 | test("Test Case One", () => {
4 | const input = [141, 2, 17, -7, -17, -27, 18, 541, 8, 7, 7];
5 | const actual = findThreeLargestNumbers(input);
6 | const expected = [18, 141, 541];
7 | expect(expected.length).toEqual(actual.length);
8 | expect(expected.every((num, index) => num === actual[index])).toBeTruthy;
9 | });
10 |
11 | test("Test Case Two", () => {
12 | const input = [11, -7, 5, -7];
13 | const actual = findThreeLargestNumbers(input);
14 | const expected = [-7, 5, 11];
15 | expect(expected.length).toEqual(actual.length);
16 | expect(expected.every((num, index) => num === actual[index])).toBeTruthy;
17 | });
18 |
19 | test("Test Case Three", () => {
20 | const input = [1];
21 | const actual = findThreeLargestNumbers(input);
22 | expect(actual).toBeNull();
23 | });
24 |
--------------------------------------------------------------------------------
/challenges/2022-11-08-common-elements/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
--------------------------------------------------------------------------------
/challenges/2022-11-08-common-elements/solution.js:
--------------------------------------------------------------------------------
1 | // # Common Elements
2 |
3 | // Create a function that takes two "sorted" arrays of numbers and returns an array of numbers which are common to both the input arrays.
4 |
5 | // ## Business Rules/Errata
6 |
7 | // - You can expect the arrays to be sorted
8 | // - Arrays do not have to be the same length
9 | // - The output array should be sorted and contain no duplicates
10 | // - This problem should be solved in O(n+m) time where n is the length of the first input array and m is the length of the second input array
11 |
12 | // ## Examples
13 |
14 | // ```
15 | // commonElements([-1, 3, 4, 6, 7, 9], [1, 3]) -> [3]
16 | // commonElements([1, 3, 4, 6, 7, 9], [1, 2, 3, 4, 7, 10]) -> [1, 3, 4, 7]
17 | // commonElements([1, 2, 2, 2, 3, 4, 5], [1, 2, 4, 5]) -> [1, 2, 4, 5]
18 | // commonElements([1, 2, 3, 4, 5], [10, 12, 13, 15]) -> []
19 | // ```
20 |
21 | // ## Tackling This Challenge
22 |
23 | function commonElements(arr1, arr2) {
24 | // your solution goes here
25 | return null
26 | }
27 |
28 | module.exports = { commonElements };
29 |
--------------------------------------------------------------------------------
/challenges/2022-11-08-common-elements/solutions/javascript/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2022-11-08-common-elements/solutions/javascript/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2023-02-14-valid-starting-city/solutions/python/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2023-02-14-valid-starting-city/solutions/python/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2023-04-11-search-sorted-matrix/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2023-04-11-search-sorted-matrix/solution.js:
--------------------------------------------------------------------------------
1 | // # Search In Sorted Matrix
2 |
3 | // You're given a two-dimensional array (a matrix) of distinct integers and a target integer. Each row in the matrix is sorted, and each column is also sorted; the matrix doesn't necessarily have the same height and width.
4 | // Write a function that returns an array of the row and column indices of the target integer if it's contained in the matrix, otherwise [-1, -1].
5 |
6 | // ## Examples
7 | // ```
8 | // matrix = [
9 | // [1, 4, 7, 12, 15, 1000],
10 | // [2, 5, 19, 31, 32, 1001],
11 | // [3, 8, 24, 33, 35, 1002],
12 | // [40, 41, 42, 44, 45, 1003],
13 | // [99, 100, 103, 106, 128, 1004],
14 | // ]
15 | // target = 44 -> [3, 3]
16 | // target = 8 -> [2, 1]
17 | // target = 1000 -> [0, 5]
18 | // target = 6 -> [-1, -1]
19 | // ```
20 |
21 | function searchSortedMatrix(matrix, target) {
22 | // your solution goes here
23 | return
24 | }
25 |
26 | module.exports = { searchSortedMatrix };
--------------------------------------------------------------------------------
/challenges/2023-04-11-search-sorted-matrix/solutions/javascript/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2023-04-11-search-sorted-matrix/solutions/javascript/.placeholder
--------------------------------------------------------------------------------
/challenges/2023-05-09-class-photos/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2023-05-09-class-photos/solutions/javascript/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2023-05-09-class-photos/solutions/javascript/.placeholder
--------------------------------------------------------------------------------
/challenges/2023-06-13-mayan-days/setup.cfg:
--------------------------------------------------------------------------------
1 | [aliases]
2 | test=pytest
3 |
4 | [tool:pytest]
5 | addopts=--junitxml=tests.xml
6 | junit_family=legacy
7 |
--------------------------------------------------------------------------------
/challenges/2023-06-13-mayan-days/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import find_packages, setup
2 |
3 | packages = [
4 | "pytest<7,>=5"
5 | ]
6 |
7 | setup(
8 | name="task",
9 | version="1.0.0",
10 | packages=find_packages(),
11 | package_dir={'': '.'},
12 | setup_requires=["pytest-runner"],
13 | tests_require=packages
14 | )
15 |
--------------------------------------------------------------------------------
/challenges/2023-06-13-mayan-days/solution.py:
--------------------------------------------------------------------------------
1 | def solve(haab_date: str) -> str:
2 | return ""
3 |
--------------------------------------------------------------------------------
/challenges/2023-06-13-mayan-days/solutions/python/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2023-06-13-mayan-days/solutions/python/.placeholder
--------------------------------------------------------------------------------
/challenges/2023-06-13-mayan-days/test_validation.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | from solution import solve
4 |
5 | # List of test cases in the form [(input, output)]
6 | TEST_CASES = [
7 | ("0. pop 0", "1 imix 0"),
8 | ("10. zac 0", "3 chuen 0"),
9 | ]
10 |
11 |
12 | @pytest.mark.parametrize("input,expected", TEST_CASES)
13 | def test_solver(input, expected):
14 | assert solve(input) == expected
15 |
--------------------------------------------------------------------------------
/challenges/2023-08-08-how-much-water/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2023-08-08-how-much-water/solution.js:
--------------------------------------------------------------------------------
1 | // How Much Water?
2 | //
3 | // You are given a list of integers, where each value represents the height of
4 | // a vertical bar that can be placed perpendicular to the x-axis and the index
5 | // of each value represents it's position on the x-axis. Using this list, find
6 | // the maximum amount of water that can be contained by any two bars together
7 | // with the x-axis. For example, given the list `[1, 8, 2, 6, 2, 5, 4, 8, 3,
8 | // ]`, the maximum amount of water that can be contained is `49`.
9 |
10 | function maximumWater(barHeights) {
11 | // your solution goes here
12 | return
13 | }
14 |
15 | module.exports = { maximumWater };
16 |
--------------------------------------------------------------------------------
/challenges/2023-08-08-how-much-water/solutions/javascript/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2023-08-08-how-much-water/solutions/javascript/.placeholder
--------------------------------------------------------------------------------
/challenges/2023-09-12-count-voice-votes/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2023-09-12-count-voice-votes/solution.js:
--------------------------------------------------------------------------------
1 | // # Count Voice Votes
2 | // ## Rules
3 | // - Write a function that accepts as its argument a list of names and returns
4 | // the name that accounts for over half of all names.
5 | // - Expect each name to appear multiple times, once for each vote cast for
6 | // that person.
7 | // - The vote detector only records votes as candidate names in lowercase.
8 | // - You may assume that your list will contain at least one name, and that
9 | // one name will account for over half the names in the list.
10 | // - Unfortunately, these townsfolk are somewhat irascible, and there are a
11 | // few folks who will just shout random nonsense to try to disrupt the
12 | // process. The list may contain more than two distinct names.
13 | // - There's more than one way to write this function. How efficient can you
14 | // be?
15 | //
16 | // ## Example
17 | //
18 | // ```
19 | // countVotes(["mary", "mary", "mary", "michael", "michael"]); -> "mary"
20 | // countVotes(["michael"]) -> "michael"
21 | // countVotes(["mary", "michael", "down with tyranny", "fake news", "mary"]) -> "mary"
22 | // ```
23 |
24 | function countVotes(votes) {
25 | // your solution goes here
26 | return
27 | }
28 |
29 | module.exports = { countVotes };
30 |
--------------------------------------------------------------------------------
/challenges/2023-09-12-count-voice-votes/solutions/elixir/brehberg/.gitignore:
--------------------------------------------------------------------------------
1 | # The directory Mix will write compiled artifacts to.
2 | /_build/
3 |
4 | # If you run "mix test --cover", coverage assets end up here.
5 | /cover/
6 |
7 | # The directory Mix downloads your dependencies sources to.
8 | /deps/
9 |
10 | # Where third-party dependencies like ExDoc output generated docs.
11 | /doc/
12 |
13 | # Ignore .fetch files in case you like to edit your project deps locally.
14 | /.fetch
15 |
16 | # If the VM crashes, it generates a dump, let's ignore it too.
17 | erl_crash.dump
18 |
19 | # Also ignore archive artifacts (built via "mix archive.build").
20 | *.ez
21 |
22 | # Ignore package tarball (built via "mix hex.build").
23 | word_count-*.tar
24 |
25 |
--------------------------------------------------------------------------------
/challenges/2023-09-12-count-voice-votes/solutions/elixir/brehberg/mix.exs:
--------------------------------------------------------------------------------
1 | defmodule CountVoiceVotes.MixProject do
2 | use Mix.Project
3 |
4 | def project do
5 | [
6 | app: :count_voice_votes,
7 | version: "0.1.0",
8 | elixir: "~> 1.10",
9 | start_permanent: Mix.env() == :prod,
10 | deps: deps()
11 | ]
12 | end
13 |
14 | # Run "mix help compile.app" to learn about applications.
15 | def application do
16 | [
17 | extra_applications: [:logger]
18 | ]
19 | end
20 |
21 | # Run "mix help deps" to learn about dependencies.
22 | defp deps do
23 | [
24 | # {:dep_from_hexpm, "~> 0.3.0"},
25 | # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
26 | ]
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/challenges/2023-09-12-count-voice-votes/solutions/elixir/brehberg/test/test_helper.exs:
--------------------------------------------------------------------------------
1 | ExUnit.start()
2 | ExUnit.configure(exclude: :pending, trace: true)
3 |
--------------------------------------------------------------------------------
/challenges/2023-09-12-count-voice-votes/solutions/javascript/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2023-09-12-count-voice-votes/solutions/javascript/.placeholder
--------------------------------------------------------------------------------
/challenges/2023-11-14-mirror-words/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2023-11-14-mirror-words/solution.js:
--------------------------------------------------------------------------------
1 | // # Mirror Words
2 | // ## Rules
3 | // - Write a function that accepts as its argument a whitespace-separated
4 | // string and returns that same string where each word has its letters
5 | // reversed.
6 | // - Since this is your first assignment, the words will always be separated
7 | // by a single space and there will be no punctuation.
8 | // - Letters in the output should also appear as the same case as they appeared
9 | // in the input.
10 | // - The reverse of an empty string is an empty string.
11 | // - The reverse of a word with only one letter is just that letter.
12 | // - You may also un-comment some additional test cases that add complexity to
13 | // the function. These are not required to solve the puzzle.
14 |
15 | // ## Example
16 |
17 | // ```
18 | // reverseWords("I know what you did last summer") -> "I wonk tahw uoy did tsal remmus"
19 | // reverseWords("") -> ""
20 | // reverseWords("a b c") -> "a b c"
21 | // ```
22 |
23 | function reverseWords(votes) {
24 | // your solution goes here
25 | return
26 | }
27 |
28 | module.exports = { reverseWords };
29 |
--------------------------------------------------------------------------------
/challenges/2023-11-14-mirror-words/solutions/javascript/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2023-11-14-mirror-words/solutions/javascript/.placeholder
--------------------------------------------------------------------------------
/challenges/2024-01-09-maximul-non-adjacent-sum/challenge.md:
--------------------------------------------------------------------------------
1 | # Maximum Non-Adjacent Number Sum
2 |
3 | Write a function that takes in an array of positive integers and returns the maximum sum of non-adjacent elements in the array.
4 | If the input array is empty, the function should return `0`.
5 |
6 | ## Business Rules/Errata
7 |
8 | - The function takes in an array of integers
9 | - The array is one dimensional and is not sorted
10 | - if the array is empty, return 0
11 | - when considering the maximum sum, integers in the array MUST be non-adjacent
12 | - Optimal Space and Time Complexity: O(n) time | O(1) space - where n is the length of the input array
13 |
14 | ## Examples
15 |
16 | ```
17 | array = [75, 105, 120, 75, 90, 135]
18 | MaxNonAdjacentSum(array) -> 330 // 75 + 120 + 135
19 | ```
--------------------------------------------------------------------------------
/challenges/2024-01-09-maximul-non-adjacent-sum/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/challenges/2024-01-09-maximul-non-adjacent-sum/solution.js:
--------------------------------------------------------------------------------
1 | // # Maximum Non-Adjacent Number Sum
2 |
3 | // Write a function that takes in an array of positive integers and returns the maximum sum of non-adjacent elements in the array.
4 | // If the input array is empty, the function should return `0`.
5 |
6 | // ## Business Rules/Errata
7 |
8 | // - The function takes in an array of integers
9 | // - The array is one dimensional and is not sorted
10 | // - if the array is empty, return 0
11 | // - when considering the maximum sum, integers in the array MUST be non-adjacent
12 | // - Optimal Space and Time Complexity: O(n) time | O(1) space - where n is the length of the input array
13 |
14 | // ## Examples
15 |
16 | // ```
17 | // array = [75, 105, 120, 75, 90, 135]
18 | // MaxNonAdjacentSum(array) -> 330 // 75 + 120 + 135
19 | // ```
20 |
21 | function MaxNonAdjacentSum(nums){
22 | // your solution goes here
23 | return;
24 | }
25 |
26 | module.exports = { MaxNonAdjacentSum };
--------------------------------------------------------------------------------
/challenges/2024-01-09-maximul-non-adjacent-sum/solution.test.js:
--------------------------------------------------------------------------------
1 | const { MaxNonAdjacentSum } = require("./solution");
2 |
3 | test("Empty Array returns Zero", () => {
4 | const arr = [];
5 | const expected = 0;
6 | const actual = MaxNonAdjacentSum(arr);
7 | expect(actual).toEqual(expected);
8 | });
9 |
10 | test("Non-Adjacent Sum is Max", () => {
11 | const arr = [75, 105, 120, 75, 90, 135];
12 | const expected = 330;
13 | const actual = MaxNonAdjacentSum(arr);
14 | expect(actual).toEqual(expected);
15 | });
16 |
17 | test("Adjacent Sum is Max", () => {
18 | const arr = [3, 5, 1, 1];
19 | const expected = 6;
20 | const actual = MaxNonAdjacentSum(arr);
21 | expect(actual).toEqual(expected);
22 | });
23 |
--------------------------------------------------------------------------------
/challenges/2024-02-12-contains-nearby-dups/solutions/python/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2024-02-12-contains-nearby-dups/solutions/python/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2024-03-12-merge-sorted-array/solutions/mob/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/challenges/2024-03-12-merge-sorted-array/solutions/mob/.placeholder
--------------------------------------------------------------------------------
/challenges/2024-10-08-name-that-number/NameThatNumber.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | NameThatNumber
6 | enable
7 | enable
8 |
9 | false
10 | true
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/challenges/2024-10-08-name-that-number/run-tests:
--------------------------------------------------------------------------------
1 | ../../resources/csharp/csharp-test-runner.sh
--------------------------------------------------------------------------------
/codingdojo-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/codingdojo-logo.png
--------------------------------------------------------------------------------
/docs/pull_request_template.md:
--------------------------------------------------------------------------------
1 | # Language
2 |
3 | What language was used for the solution?
4 |
5 | # Challenge
6 |
7 | What is the name of the challenge being completed?
--------------------------------------------------------------------------------
/logo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
14 |
15 |
16 | >_ Coding Dojo
17 |
18 |
19 |
--------------------------------------------------------------------------------
/resources/README.md:
--------------------------------------------------------------------------------
1 | # Resources
2 |
3 | This directory is intended to hold resources used by multiple challenges, such as `*.jar` files used by Java-based challenges and testing scripts. Resources will be nested in sub-directories by the languages that rely on those resources. For example, the JUnit .jar file is in `resources/java/junit-.jar`.
4 |
--------------------------------------------------------------------------------
/resources/csharp/Sample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/resources/java/junit5-1.8.0-M1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/resources/java/junit5-1.8.0-M1.jar
--------------------------------------------------------------------------------
/resources/javascript/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "coding-dojo-js-challenge",
3 | "version": "1.0.0",
4 | "description": "JavaScript-based codeconnector/CodingDojo challenge",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "jest"
8 | },
9 | "author": "",
10 | "license": "MIT",
11 | "dependencies": {
12 | "npm": "^7.9.0"
13 | },
14 | "devDependencies": {
15 | "jest": "^26.6.3"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/resources/kotlin/build.gradle.kts:
--------------------------------------------------------------------------------
1 | import org.gradle.api.tasks.testing.logging.TestExceptionFormat
2 |
3 | plugins {
4 | kotlin("jvm") version "1.3.60"
5 | }
6 |
7 | repositories {
8 | jcenter()
9 | }
10 |
11 | dependencies {
12 | compile(kotlin("stdlib"))
13 |
14 | testImplementation("junit:junit:4.12")
15 | testImplementation(kotlin("test-junit"))
16 | }
17 |
18 | tasks.withType {
19 | testLogging {
20 | exceptionFormat = TestExceptionFormat.FULL
21 | events("passed", "failed", "skipped")
22 | }
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/resources/kotlin/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codeconnector/CodingDojo/a66d8443e4bd64441443b50c10e709851ed343fb/resources/kotlin/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/resources/kotlin/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/resources/kotlin/run_tests.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ../../resources/kotlin/gradlew test --info
4 | ln -s build/reports/tests/test/index.html test_report.html
5 | echo "You can also view test results in the 'test_report.html' file."
6 |
--------------------------------------------------------------------------------
/resources/python/python-test-runner.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | python3 -m unittest solution.py
4 |
--------------------------------------------------------------------------------