codeconnector / codingdojo Goto Github PK
View Code? Open in Web Editor NEWThe place to come for pair programming practice problems in your language, designed for new and old developers alike.
License: MIT License
The place to come for pair programming practice problems in your language, designed for new and old developers alike.
License: MIT License
Given a string of round, curly, and square open and closing brackets, return whether the brackets are balanced (well-formed).
For example, given the string "([])", you should return true.
Given the string "([)]" or "((()", you should return false.
(
, )
, [
, ]
, {
, and }
.balanced_brackets("[[]]({}[])"); // true
balanced_brackets("[[({}[])"); // false
balanced_brackets(""); // true
balanced_brackets("(5 * 3) + 4"); // true
Given a square (NxN) matrix of '0's and '1's, determine how many ways the matrix can be traversed from the top left element to the bottom right element.
input = [[0, 0, 1],
[0, 0, 1],
[1, 0, 0]]
count_paths(input) // 2
In this case, there are two viable paths, starting at the top left:
Given a string, determine whether any permutation of it is a palindrome. A palindrome is any string that can be read the same both forwards and backwards, such as "kayak".
can_make_palindrome("carrace"); // True
The string carrace
can be rearranged to make racecar
, a palindrome.
Given an array of integers in which two elements appear exactly once and all other elements appear exactly twice, find the two elements that appear only once.
input = [2, 4, 6, 8, 10, 2, 6, 10];
find_singles(input) // [4, 8]
input = [1, 2, 3, 2, 1, 4, 4, 6, 7, 8, 7, 6, 9, 9];
find_singles(input) // [3, 8]
Given a pair of rectangles, determine whether one of the rectangles is completely contained within the other rectangle. You will be given each rectangles top-left coordinate in an x/y plane, the rectangle's width, and the rectangle's height. One rectangle is "completely contained" by a rectangle that completely covers it, if viewed from above the plane. This puzzle should be solved using an Object-Oriented approach.
Rectangle
objects in your solution, not the raw rectangle measurements.false
if the two rectangles only partially overlap.rectangle1 = [1, 4, 3, 3]
rectangle2 = [0, 3, 2, 1]
rectanglesOverlap(rectangle1, rectangle2) // false
rectangle1 = [1, 4, 3, 3]
rectangle2 = [0, 3, 4, 4]
rectanglesOverlap(rectangle1, rectangle2) // true
rectangle1 = [1, 4, 3, 3]
rectangle2 = [0, 3, 3, 3]
rectanglesOverlap(rectangle1, rectangle2) // false
Given a positive integer n
, find the smallest number of squared integers which sum to n
(i.e. n = x² + y²
should yield 2
).
n
, not the list of integers.count_squared_addends(13); // 2
count_squared_addends(27); // 3
n
= 13: 3² + 2² = 9 + 4 = 13n
= 27:
You are given n
fair coins, and you flip all at the same time. Every time a coin comes up 'tails', it is removed from play. The ones that come up 'heads', you will flip again on the next round. Write a function that, given n
, returns the number of rounds you'd expect to play until only one coin remains.
count_coin_rounds(2) // 1
count_coin_rounds(100) // 7
count_coin_rounds(1000) // 10
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.
This section should provide examples of expected inputs/outputs like so:
jump_to(0) // 0: start at 0
jump_to(1) // 1: 0 -> 1
jump_to(2) // 3: 0 -> 1 -> -1 -> 2
jump_to(-2) // 3: 0 -> -1 -> 1 -> -2
jump_to(175) // 21
In Ancient Greece, it was common to write text with the first line going left to right, the second line going right to left, and continuing to go back and forth. This style was called "boustrophedon".
Given a binary tree, write an algorithm to print the nodes in boustrophedon order.
value
, left
, and right
.
value
will contain the value in that tree node, and will be the value you output in your result.left
will contain the tree node to the left of the current node.right
will contain the tree node to the right of the current node.left
or right
value.// a
// / \
// b c
// / | | \
// d e f g
input = {'a', {'b', {'d'}, {'e'}}, {'c', {'f'}, {'g'}}}
boustrophedon(input) // ['a', 'c', 'b', 'd', 'e', 'f', 'g']
// _____ p _____
// / \
// _ o _ _ r _
// / \ / \
// g n o s
// / \ / \ / \ / \
// n o i t a c i t
input = {'p', {'o', {'g', {'n'}, {'o'}}, {'n', {'i'}, {'t'}}}, {'r', {'o', {'a'}, {'c'}}, {'s', {'i'}, {'t'}}}}
boustrophedon(input) // ['p', 'r', 'o', 'g', 'n', 'o', 's', 't', 'i', 'c', 'a', 't', 'i', 'o', 'n']
All Hacktoberfest solutions should be provably correct. That is, solution submissions should either include the unit tests from the original challenge (implemented in your language of choice) or at least print out the expected answers when run by the maintainers. Solutions that do not meet these criteria may be rejected, or flagged as 'invalid' or 'spam' in egregious cases. This can result in your PR not counting towards your Hacktoberfest participation or becoming ineligible to participate in Hacktoberfest. Violations of our Code of Conduct will be reported, and will also render you ineligible to participate in Hacktoberfest. Please be respectful of the maintainers' and other participants' time by doing your best to submit real solutions to the puzzles. Thanks, and welcome to our learning community!
Complete this challenge using a Bash/Shell script.
Shell scripts expect to take a string as input and echo to stdout as output. For added credibility, prove your solution with unit tests. One option for unit testing Bash scripts is bats.
You are given an array of arrays of integers, where each array corresponds to a row in a triangle of numbers. For example, [[1], [2, 3], [1, 5, 1]]
represents the triangle:
1
2 3
1 5 1
We define a path in the triangle to start at the top and go down one row at a time to an adjacent value, eventually ending with an entry on the bottom row. For example, 1 -> 3 -> 5. The weight of the path is the sum of the entries.
Write a program that returns the weight of the maximum weight path.
0
.[[5]]
yields 5
.// 1
// 2 3
// 1 5 1
input = [[1], [2, 3], [1, 5, 1]]
longest_path(input) // 9 (1 -> 3 -> 5)
// 6
// 4 4
// 1 2 1
// 5 4 3 2
input = [[6], [4, 4], [1, 2, 1], [5, 4, 3, 2]]
longest_path(input) // 16, either (6 -> 4 -> 1 -> 5) or (6 -> 4 -> 2 -> 4)
The 24
game is played as follows. You are given a list of four integers, each between 1 and 9, in a fixed order. By placing the operators +, -, *, and / between the numbers, and grouping them with parentheses, determine whether it is possible to reach the value 24
.
For example, given the input [5, 2, 7, 8], you should return True, since (5 * 2 - 7) * 8 = 24.
Write a function that plays the 24
game.
24
. You do not need to produce the formula that yields 24
.3 / 2 = 2
, not 3 / 2 = 1
.play([5, 2, 7, 8]); // True -> (5 * 2 - 7) * 8 = 24
play([2, 4, 8, 10]); // True -> 2 + 4 + 8 + 10 = 24
play([5, 0, 4, 4]); // True -> (5 + 0) * 4 + 4 = 24
play([47, 2, 0, 0]); // True -> (47 / 2) + 0 + 0 = 24
play([1, 5, 7, 19]); // False, no combinations yield 24
All Hacktoberfest solutions should be provably correct. That is, solution submissions should either include the unit tests from the original challenge (implemented in your language of choice) or at least print out the expected answers when run by the maintainers. Solutions that do not meet these criteria may be rejected, or flagged as 'invalid' or 'spam' in egregious cases. This can result in your PR not counting towards your Hacktoberfest participation or becoming ineligible to participate in Hacktoberfest. Violations of our Code of Conduct will be reported, and will also render you ineligible to participate in Hacktoberfest. Please be respectful of the maintainers' and other participants' time by doing your best to submit real solutions to the puzzles. Thanks, and welcome to our learning community!
Java
For added credibility, prove your solution with unit tests. Check out any of our Java-based challenges for an IDE-agnostic testing setup. or use the built-in tools from your favorite IDE.
After #135 the only thing missing on our Community tab is having a PR template. I feel like this would help contributors, mainly for solutions.
Given a string and a number of lines k, print the string in zigzag form. In zigzag, characters are printed out diagonally from top left to bottom right until reaching the kth line, then back up to top right, and so on.
For example, given the sentence "thisisazigzag" and k = 4, you should print:
t a g
h s z a
i i i z
s g
printzigzag("bismarcks", 3) // "b a s\n i m r k \n s c "
b a s
i m r k
s c
printzigzag("thisisazigzag", 4) // "t a g\n h s z a \n i i i z \n s g "
t a g
h s z a
i i i z
s g
printzigzag("ilovechickenandwaffles", 5) // "i c a \n l i k w f \n o h e d f \n v c n n l s\n e a e "
i c a
l i k w f
o h e d f
v c n n l s
e a e
We need to decide on a directory structure. There is a proposal by @drkennetz that we separate challenges from solutions
from Slack
Format could be:
./CodingDojo/questions/
./03-26-2021/question.MD
./04-02-2021/question.MD./CodingDojo/answers/
./03-26-2021/answer.py, answer.js, answer.java, answer.rb
./CodingDojo/answers/
./03-26-2021/answer.py, answer.js, answer.java, answer.rb
(edited to properly display format)
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.
[10, 5, 9, 10, 12]
should return [10, 10, 12]
This section should provide examples of expected inputs/outputs like so:
findThreeLargestNumbers([141, 1, 17, -7, -17, -27, 18, 541, 8, 7, 7]) -> [18, 141, 541]
findThreeLargestNumbers([11, -7, 5]) -> [-7, 5, 11]
findThreeLargestNumbers([1]) -> Null
All Hacktoberfest solutions should be provably correct. That is, solution submissions should either include the unit tests from the original challenge (implemented in your language of choice) or at least print out the expected answers when run by the maintainers. Solutions that do not meet these criteria may be rejected, or flagged as 'invalid' or 'spam' in egregious cases. This can result in your PR not counting towards your Hacktoberfest participation or becoming ineligible to participate in Hacktoberfest. Violations of our Code of Conduct will be reported, and will also render you ineligible to participate in Hacktoberfest. Please be respectful of the maintainers' and other participants' time by doing your best to submit real solutions to the puzzles. Thanks, and welcome to our learning community!
This challenge was originally set up for Ruby, but it looks like a Ruby solution was never submitted! Yikes! Solve this challenge in Ruby and fix that oversight for us, please.
Use the original unit tests!
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.
nested_dict = {
"key": 3,
"foo": {
"a": 5,
"bar": {
"baz": 8
}
}
}
result = flattenDictionary(nested_dict)
print(result)
{
"key": 3,
"foo.a": 5,
"foo.bar.baz": 8
}
Given two words in a string of words, count the number of other words between the two words you are given.
list_of_words = "There was an old lady who lived in an outhouse";
count_words_between("lady", "outhouse", list_of_words) // 4
count_words_between("an", "outhouse", list_of_words) // 6
Given an array of values, return the sum of the values.
One dimension:
sum_of_array([1,2,3,4,5]) => 15
Two dimensions:
sum_of_array([1,2,[1,2,3],4,5]) => 18
n dimensions:
sum_of_array([1,[1,2,[3,4],5],[6,7]]) => 29
To help with people learning about our repository through Hacktoberfest, we should include a link to the meetup page for people to join us in the future.
You are writing an AI for a 2D map game. Specifically, you are writing the AI for a Goblin
, who only cares about one thing: money! Your goblin is somewhere in a 2D grid, and there are coins strewn about over the map. Because goblins are not very smart, your goblin should seek out the closest coin, go grab it, then move on to the next closest coin.
Given the position of all the coins and your current position, calculate the "optimal" path for your goblin, as described above. The closest coin to your goblin should be evaluated in terms of Manhattan distance. That is, the number of spaces the goblin will need to move up, down, left, or right to reach the coin.
For example, given the following input:
Goblin: (0, 2)
Coins: [(0, 4), (1, 0), (2, 0), (3, 2), (2, 4)]
represented by the below map, where your goblin is "G", coins are "o", and empty spaces are ".":
---------------------
| . | . | G | . | o |
---------------------
| o | . | . | . | . |
---------------------
| o | . | . | . | o |
---------------------
| . | . | o | . | . |
---------------------
you goblin will visit (0, 4) -> (2, 4) -> (3, 2) -> (2, 0) -> (1, 0)
.
goblin = (1, 1)
coins = [(1, 2), (-5, -5), (1, 3)]
goblin_path(goblin, coins) // [(1, 2), (1, 3), (-5, -5)]
goblin = (0, 2)
coins = [(0, 4), (1, 0), (2, 0), (3, 2), (2, 4)]
goblin_path(goblin, coins) // [(0, 4), (2, 4), (3, 2), (2, 0), (1, 0)]
goblin = (100, 100)
coins = [(99, 100), (101, 100), (100, 99), (100, 101)]
goblin_path(goblin, coins) // [] -- he panicked
Discussion has been going around as to how we handle the flow of week to week tasks in preparation for the next mob session.
Challenges will be submitted as issues. Voting on these (👍) should be restricted to one vote per person each week.
Challenge will be posted on Friday (Monday may be tried as well) for the following week.
Given an array of integers out of order, determine the bounds of the smallest window that must be sorted in order for the entire array to be sorted. For example, given [3, 7, 5, 6, 9], you should return (1, 3).
sort_window([3, 7, 5, 6, 9]) // [2, 4]
sort_window([1, 2, 6, 5, 4]) // [3, 5]
sort_window([3, 2, 1, 4, 5]) // [1, 3]
sort_window([5, 4, 3, 2, 1]) // [1, 5]
sort_window([1, 2, 3, 4, 5]) // []
sort_window([1]) // []
sort_window([]) // []
They are currently multiple .gitignore files scattered throughout the challenges.
These files should be consolidated to one main .gitignore file and then the scattered files should be removed.
Spreadsheets often use an alphabetical encoding for naming columns: "A", "B", "C", ..., "AA", "AB", ..., "ZZ", "AAA", "AAB", ....
Given a column number, return its alphabetical column id. For example, given 1, return "A". Given 27, return "AA".
to_spreadsheet_colname(1); // "A"
to_spreadsheet_colname(27); // "AA"
to_spreadsheet_colname(52); // "AZ"
to_spreadsheet_colname(287); // "KA"
All Hacktoberfest solutions should be provably correct. That is, solution submissions should either include the unit tests from the original challenge (implemented in your language of choice) or at least print out the expected answers when run by the maintainers. Solutions that do not meet these criteria may be rejected, or flagged as 'invalid' or 'spam' in egregious cases. This can result in your PR not counting towards your Hacktoberfest participation or becoming ineligible to participate in Hacktoberfest. Violations of our Code of Conduct will be reported, and will also render you ineligible to participate in Hacktoberfest. Please be respectful of the maintainers' and other participants' time by doing your best to submit real solutions to the puzzles. Thanks, and welcome to our learning community!
Complete this challenge using a Bash/Shell script.
Shell scripts expect to take a string as input and echo to stdout as output. For added credibility, prove your solution with unit tests. One option for unit testing Bash scripts is bats.
PR's should reference the issue number for ease of review and closure.
Given a positive integer n
, determine the length of the longest run of 1
's in the binary representation of that integer.
1
's is any series of one or more 1
's in a row, with no 0
's in between. The first four characters in 11110101
are a run of 1
's.n
.longest_binary_run(156); // 3
longest_binary_run(1979); // 4
longest_binary_run(2731); // 2
longest_binary_run(2185); // 1
Write a function that takes in an array of integers and returns a Boolean representing whether the array is monotonic. An array is said to be monotonic if its elements, from left to right, are entirely non-increasing or entirely non-decreasing (don't worry, I'll make this very clear with examples!)
Arrays containing only the same element are also said to be monotonic because they are both entirely non-increasing and entirely non-decreasing.
Non-increasing elements aren't necessarily exclusively decreasing; they simply don't increase. Similarly, non-decreasing elements aren't necessarily exclusively increasing; they simply don't decrease.
Note that empty arrays and arrays of one element are monotonic.
[1, 2, 3, 3]
is an increasing monotonic array because the numbers are never decreasing.True
, otherwise it should return False
.is_monotonic([]) // True
is_monotonic([1]) // True
is_monotonic([1, 2]) // True
is_monotonic([2, 2, 2, 2]) // True
is_monotonic([-5, -4, -3, -2, -1, 0, 1]) // True
is_monotonic([2, 1, 2, 3, 4, 5]) // False
is_monotonic([1, 1, 0, 0, -1, -1, -2, -2]) // True
is_monotonic([5, 4, 3, 3, 3, 2, 1]) // True
Configure to include solutions directories only.
information:
Implement a class (or struct, or object) representing a 2-dimensional iterator. This class should be initialized with a 2-dimensional (nested) array, and should implement two methods:
next()
returns the next element in the array of arrayshas_next()
returns true/false indicating whether the iterator still has elements leftflatten
or otherwise copy data out of the 2D array into another data structure.next()
on your class, and there are no elements left to return, return null
(or some other indicator that the iterator has been exhausted).instance = new NestedIterator([[1, 2], [3], [], [4, 5, 6]]);
instance.next() // 1
instance.next() // 2
instance.next() // 3
instance.has_next() // true
instance.next() // 4
instance.next() // 5
instance.next() // 6
instance.has_next() // false
instance.next() // NULL
instance = new NestedIterator([[9], [1, 7, 5], [2, 9], []]);
instance.next() // 9
instance.next() // 1
instance.next() // 7
instance.has_next() // true
instance.next() // 5
instance.next() // 6
instance.next() // 9
instance.has_next() // false
instance.next() // NULL
Create on boarding document for new leaders to the Coding Dojo
In mathematics, the look-and-say sequence is the sequence of integers beginning as follows:
1, 11, 21, 1211, 111221, 312211, …
To generate a member of the sequence from the previous member, read off the digits of
the previous member, counting the number of digits in groups of the same digit
For Example:
1 is read off as "one 1" or 11.
11 is read off as "two 1s" or 21.
21 is read off as "one 2, then one 1" or 1211.
1211 is read off as "one 1, then one 2, then two 1s" or 111221.
111221 is read off as "three 1s, then two 2s, then one 1" or 312211.
Your mission is to write a function which, given an integer n as parameter, returns a
comma separated list of the first n terms of the sequence. For 0, an empty string
shall be returned.
For 0, negative, or NaN parameters, -1 shall be returned.
get_lines(2); // "1,11"
get_lines(3); // "1,11,21"
get_lines(5); // "1,11,21,1211,111221"
A classroom consists of N students, whose friendships can be represented in an adjacency list. For example, the following describes a situation where 0 is friends with 1 and 2, 3 is friends with 6, and so on.
{0: [1, 2],
1: [0, 5],
2: [0],
3: [6],
4: [],
5: [1],
6: [3]}
Each student can be placed in a friend group, which can be defined as the the smallest set of students such that no student in the group has any friends outside this group. For the example above, the friend groups would be {0, 1, 2, 5}, {3, 6}, {4}.
Given a friendship list such as the one above, determine the number of friend groups in the class.
friendList = {
0: [1, 2], 1: [0, 5], 2: [0],
3: [6] , 4: [] , 5: [1],
6: [3]
}
friendGroups(friendList) // 3, groups {0, 1, 2, 5}, {3, 6}, {4}
friendList = {
0: [1, 2], 1: [0, 2], 2: [0, 1, 3],
3: [2, 4], 4: [3, 5], 5: [3, 4]
}
friendGroups(friendList) // 1, student 3 bridges the two groups
friendList = {
0: [1], 1: [0], 2: [3], 3: [2],
4: [5], 5: [4], 6: [7], 7: [6]
}
friendGroups(friendList) // 4, groups {0, 1}, {2, 3}, {4, 5}, {6, 7}
You are managing logistics for an intergalactic delivery service. Your current task is to calculate the amount of time needed to deliver a set of packages. In the best case, the time needed to deliver a package is the difference between the package "pickup" and package "dropoff" events. Unfortunately, it's a dangerous universe out there, and sometimes the courier gets eaten (an "eaten" event). It's really a good news/bad news sort of situation. The good news is that your delivery service has access to a limited form of time travel, so you can send out multiple couriers at the same time (you should see the looks on their faces when two leave at the same time, though). The bad news is that you have to count the time for all the couriers, no matter how many it takes to make a delivery.
Your input data is given in a list of data formatted like the following:
(delivery id, timestamp, event)
The timestamp is a Unix Timestamp. Your function should calculate the total time for all deliveries, including 'mishaps'. For example, if the input is the following:
(1, 1570320047, 'pickup')
(1, 1570320725, 'dropoff')
(2, 1570321092, 'pickup')
(3, 1570321212, 'pickup')
(3, 1570322352, 'dropoff')
(2, 1570323012, 'dropoff')
(2, 1570322092, 'eaten')
The total active time would be 4738 seconds by the following schedule:
(1, 1570320047, 'pickup') -> (1, 1570320725, 'dropoff') => 678 seconds
(2, 1570321092, 'pickup') -> (2, 1570322092, 'eaten') => 1000 seconds, first attempt
(2, 1570321092, 'pickup') -> (2, 1570323012, 'dropoff') => 1920 seconds, second attempt
(3, 1570321212, 'pickup') -> (3, 1570322352, 'dropoff') => 1140 seconds
See above.
Given a sorted array of integers, find the smallest positive integer that is not the sum of a subset of the array.
min_impossible_sum([5]) // 1
min_impossible_sum([1]) // 2
min_impossible_sum([1, 2, 3, 10]) // 7
min_impossible_sum([1, 2, 3, 7, 10]) // 24
Given a start
word, and end
word, and a "dictionary" of valid words, find the shortest transformation sequence from start
to end
such that only one letter is changed at each step of the sequence, and each transformed word exists in the dictionary. If there is no possible transformation, return NULL.
start
, stop
, and "dictionary" words will all be the same length and all lowercase.start = "dog"
end = "cat"
dictionary = ["dot", "dop", "dat", "cat"]
findTransformSequence(start, end, dictionary) // ["dog", "dot", "dat", "cat"]
start = "dog"
end = "cat"
dictionary = ["dot", "tod", "dat", "dar"]
findTransformSequence(start, end, dictionary) // NULL
the Challenge setup will require some nearly complete broken bits of code
Can reuse a previous challenge that is sufficiently complex to have multiple functions that may need troubleshooting.
Given a linked list, remove all consecutive nodes that sum to zero.
For example, suppose you are given the input 3 -> 4 -> -7 -> 5 -> -6 -> 6
. In this case, you should first remove 3 -> 4 -> -7
, then -6 -> 6
, leaving only 5
.
1 -> -1
), return NULL
(or your language's equivalent).input = 1 -> 2 -> 3 -> 4 -> -4 -> -3 -> 5
remove_zero_sequences(input) // 1 -> 2 -> 5
input = 2 -> -2 -> 3 -> 4 -> 5 -> -9
remove_zero_sequences(input) // 3
input = 1 -> -10 -> 5 -> 4
remove_zero_sequences(input) // NULL
Given an array of sorted positive integers representing the values of coins in your possession, write a function that returns the minimum amount of change (the minimum sum of money) that you cannot create.
coins = [1]
nonConstructibleChange(coins) // 2
coins = [1, 1, 1, 1, 1]
nonConstructibleChange(coins) // 6
coins = [1, 1, 2, 3, 5, 7, 22]
nonConstructibleChange(coins) // 20
coins = [1, 1, 4, 5, 6, 8, 9]
nonConstructibleChange(coins) // 3
coins = [1, 1, 1, 1, 5, 10, 15, 20, 100]
nonConstructibleChange(coins) // 55
Given a tab delimited text file with two columns with a header: ['HighSchool Year', 'ACT Score']
, complete the following tasks:
HighSchool Year
and return the mean and median ACT Score
of each year.As a bonus, plot the mean score as a function high school year and determine if there is a correlation between test scores and high school year.
Here is an example of the data file (tab delimited text):
HighSchool Year ACT Score
Sophomore 22
Junior 28
Freshman 21
Freshman 19
Junior 24
Senior 25
Senior 31
Sophomore 31
Outputs of grouping (dataframe example):
HighSchool Year Mean Median
Freshman 20 20
Sophomore 26.5 26.5
Junior 26 26
Senior 28 28
###
# outputs of:
#return the number of scores greater than 25.
3
#return the number of sophomore scores greater than 25 and less than 30.
0
#return the mean of only the sophomore and junior scores.
26.25
All Hacktoberfest solutions should be provably correct. That is, solution submissions should either include the unit tests from the original challenge (implemented in your language of choice) or at least print out the expected answers when run by the maintainers. Solutions that do not meet these criteria may be rejected, or flagged as 'invalid' or 'spam' in egregious cases. This can result in your PR not counting towards your Hacktoberfest participation or becoming ineligible to participate in Hacktoberfest. Violations of our Code of Conduct will be reported, and will also render you ineligible to participate in Hacktoberfest. Please be respectful of the maintainers' and other participants' time by doing your best to submit real solutions to the puzzles. Thanks, and welcome to our learning community!
Give Ruby a chance to shine! Solve this challenge in Ruby.
Make it work?
All Hacktoberfest solutions should be provably correct. That is, solution submissions should either include the unit tests from the original challenge (implemented in your language of choice) or at least print out the expected answers when run by the maintainers. Solutions that do not meet these criteria may be rejected, or flagged as 'invalid' or 'spam' in egregious cases. This can result in your PR not counting towards your Hacktoberfest participation or becoming ineligible to participate in Hacktoberfest. Violations of our Code of Conduct will be reported, and will also render you ineligible to participate in Hacktoberfest. Please be respectful of the maintainers' and other participants' time by doing your best to submit real solutions to the puzzles. Thanks, and welcome to our learning community!
Can you believe we never got any additional solutions for this one? Solve this challenge in Python, how about?
Check out some of the other solutions in the repo for ideas about how to use unit tests to prove your solution works.
All Hacktoberfest solutions should be provably correct. That is, solution submissions should either include the unit tests from the original challenge (implemented in your language of choice) or at least print out the expected answers when run by the maintainers. Solutions that do not meet these criteria may be rejected, or flagged as 'invalid' or 'spam' in egregious cases. This can result in your PR not counting towards your Hacktoberfest participation or becoming ineligible to participate in Hacktoberfest. Violations of our Code of Conduct will be reported, and will also render you ineligible to participate in Hacktoberfest. Please be respectful of the maintainers' and other participants' time by doing your best to submit real solutions to the puzzles. Thanks, and welcome to our learning community!
Lots of Java in the repo already, add some more! Solve this challenge using Java.
Check out some of our Java-based challenges for an IDE-agnostic unit-testing setup, or use the tools built in to your favorite IDE.
You're given an array of integers and an integer. Write a function that moves all instances of that integer in the array to the end of the array and returns the array. The potential difficulty of this challenge lies in achieving the optimal time and space complexity, so they will be a rule requirement.
array = [2, 1, 2, 2, 2, 3, 4, 2]
to_move = 2
move_element_to_end(array, to_move) -> [1, 3, 4, 2, 2, 2, 2, 2] # 1, 3, 4 in this do not have to maintain their original order of appearance in the array, although they can
All Hacktoberfest solutions should be provably correct. That is, solution submissions should either include the unit tests from the original challenge (implemented in your language of choice) or at least print out the expected answers when run by the maintainers. Solutions that do not meet these criteria may be rejected, or flagged as 'invalid' or 'spam' in egregious cases. This can result in your PR not counting towards your Hacktoberfest participation or becoming ineligible to participate in Hacktoberfest. Violations of our Code of Conduct will be reported, and will also render you ineligible to participate in Hacktoberfest. Please be respectful of the maintainers' and other participants' time by doing your best to submit real solutions to the puzzles. Thanks, and welcome to our learning community!
Solve this challenge in Rust!
If you've never implemented a Trait before, try creating/implementing an Overlaps
trait for boundary checking. If you're new to Rust, then forget about Traits and just make sure you include unit tests.
Given a array that's sorted but rotated at some unknown pivot, in which all elements are distinct, find the "peak" element. An element is considered a peak if it is greater than both its left and right neighbors. For example, [1, 2, 3, 2, 1]
has a peak element of 3
.
pick_peak([1, 2, 3, 2, 1]); // 3
pick_peak([1, 2, 3, 4, 5]); // 5
pick_peak([5, 4, 3, 2, 1]); // 5
pick_peak([1]); // 1
You are given an string representing the initial conditions of some dominoes. Each element can take one of three values:
Determine the orientation of each tile when the dominoes stop falling. Note that if a domino receives a force from the left and right side simultaneously, it will remain upright.
For example, given the string .L.R.....L, you should return LL.RRR.LLL.
topple(".L.R....L") // "LL.RRRLLL"
topple("L.......R") // "L.......R"
topple("R........") // "RRRRRRRRR"
topple("........L") // "LLLLLLLLL"
topple("RLRLRLRLR") // "RLRLRLRLR"
topple("R..L.R..L") // "RRLL.RRLL"
topple("...L.R...") // "LLLL.RRRR"
topple("R.......L") // "RRRR.LLLL"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.