diff --git a/Easy Challenges/Challenge #0208 [Easy] Culling Numbers/solutions/solution.c b/Easy Challenges/Challenge 0208 Easy - Culling Numbers/solutions/solution.c similarity index 100% rename from Easy Challenges/Challenge #0208 [Easy] Culling Numbers/solutions/solution.c rename to Easy Challenges/Challenge 0208 Easy - Culling Numbers/solutions/solution.c diff --git a/Easy Challenges/Challenge #260 [Easy] Garage Door Opener/challenge_text.md b/Easy Challenges/Challenge 0260 Easy - Garage Door Opener/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #260 [Easy] Garage Door Opener/challenge_text.md rename to Easy Challenges/Challenge 0260 Easy - Garage Door Opener/challenge_text.md diff --git a/Easy Challenges/Challenge #261 [Easy] verifying 3x3 magic squares/challenge_text.md b/Easy Challenges/Challenge 0261 Easy - verifying 3x3 magic squares/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #261 [Easy] verifying 3x3 magic squares/challenge_text.md rename to Easy Challenges/Challenge 0261 Easy - verifying 3x3 magic squares/challenge_text.md diff --git a/Easy Challenges/Challenge #261 [Easy] verifying 3x3 magic squares/solutions/solution.py b/Easy Challenges/Challenge 0261 Easy - verifying 3x3 magic squares/solutions/solution.py similarity index 100% rename from Easy Challenges/Challenge #261 [Easy] verifying 3x3 magic squares/solutions/solution.py rename to Easy Challenges/Challenge 0261 Easy - verifying 3x3 magic squares/solutions/solution.py diff --git a/Easy Challenges/Challenge #261 [Easy] verifying 3x3 magic squares/solutions/solution.rb b/Easy Challenges/Challenge 0261 Easy - verifying 3x3 magic squares/solutions/solution.rb similarity index 100% rename from Easy Challenges/Challenge #261 [Easy] verifying 3x3 magic squares/solutions/solution.rb rename to Easy Challenges/Challenge 0261 Easy - verifying 3x3 magic squares/solutions/solution.rb diff --git a/Easy Challenges/Challenge #262 [Easy] MaybeNumeric/challenge_text.md b/Easy Challenges/Challenge 0262 Easy - MaybeNumeric/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #262 [Easy] MaybeNumeric/challenge_text.md rename to Easy Challenges/Challenge 0262 Easy - MaybeNumeric/challenge_text.md diff --git a/Easy Challenges/Challenge #263 [Easy] Calculating Shannon Entropy of a String/challenge_text.md b/Easy Challenges/Challenge 0263 Easy - Calculating Shannon Entropy of a String/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #263 [Easy] Calculating Shannon Entropy of a String/challenge_text.md rename to Easy Challenges/Challenge 0263 Easy - Calculating Shannon Entropy of a String/challenge_text.md diff --git a/Easy Challenges/Challenge #263 [Easy] Calculating Shannon Entropy of a String/solutions/solution.c b/Easy Challenges/Challenge 0263 Easy - Calculating Shannon Entropy of a String/solutions/solution.c similarity index 100% rename from Easy Challenges/Challenge #263 [Easy] Calculating Shannon Entropy of a String/solutions/solution.c rename to Easy Challenges/Challenge 0263 Easy - Calculating Shannon Entropy of a String/solutions/solution.c diff --git a/Easy Challenges/Challenge #264 [Easy] Sort my code/challenge_text.md b/Easy Challenges/Challenge 0264 Easy - Sort my code/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #264 [Easy] Sort my code/challenge_text.md rename to Easy Challenges/Challenge 0264 Easy - Sort my code/challenge_text.md diff --git a/Easy Challenges/Challenge #265 [Easy] Permutations and combinations part 1/challenge_text.md b/Easy Challenges/Challenge 0265 Easy - Permutations and combinations part 1/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #265 [Easy] Permutations and combinations part 1/challenge_text.md rename to Easy Challenges/Challenge 0265 Easy - Permutations and combinations part 1/challenge_text.md diff --git a/Easy Challenges/Challenge #265 [Easy] Permutations and combinations part 2/challenge_text.md b/Easy Challenges/Challenge 0265 Easy - Permutations and combinations part 2/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #265 [Easy] Permutations and combinations part 2/challenge_text.md rename to Easy Challenges/Challenge 0265 Easy - Permutations and combinations part 2/challenge_text.md diff --git a/Easy Challenges/Challenge #266 [Easy] Basic Graph Statistics Node Degrees/challenge_text.md b/Easy Challenges/Challenge 0266 Easy - Basic Graph Statistics Node Degrees/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #266 [Easy] Basic Graph Statistics Node Degrees/challenge_text.md rename to Easy Challenges/Challenge 0266 Easy - Basic Graph Statistics Node Degrees/challenge_text.md diff --git a/Easy Challenges/Challenge #267 [Easy] All the places your dog didn't win/challenge_text.md b/Easy Challenges/Challenge 0267 Easy - All the places your dog didn't win/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #267 [Easy] All the places your dog didn't win/challenge_text.md rename to Easy Challenges/Challenge 0267 Easy - All the places your dog didn't win/challenge_text.md diff --git a/Easy Challenges/Challenge #267 [Easy] All the places your dog didn't win/solutions/solution.py b/Easy Challenges/Challenge 0267 Easy - All the places your dog didn't win/solutions/solution.py similarity index 100% rename from Easy Challenges/Challenge #267 [Easy] All the places your dog didn't win/solutions/solution.py rename to Easy Challenges/Challenge 0267 Easy - All the places your dog didn't win/solutions/solution.py diff --git a/Easy Challenges/Challenge #268 [Easy] Network and Cards Part 1, The network/challenge_text.md b/Easy Challenges/Challenge 0268 Easy - Network and Cards Part 1, The network/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #268 [Easy] Network and Cards Part 1, The network/challenge_text.md rename to Easy Challenges/Challenge 0268 Easy - Network and Cards Part 1, The network/challenge_text.md diff --git a/Easy Challenges/Challenge #269 [Easy] BASIC Formatting/challenge_text.md b/Easy Challenges/Challenge 0269 Easy - BASIC Formatting/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #269 [Easy] BASIC Formatting/challenge_text.md rename to Easy Challenges/Challenge 0269 Easy - BASIC Formatting/challenge_text.md diff --git a/Easy Challenges/Challenge #271 [Easy] Critical Hit/challenge_text.md b/Easy Challenges/Challenge 0271 Easy - Critical Hit/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #271 [Easy] Critical Hit/challenge_text.md rename to Easy Challenges/Challenge 0271 Easy - Critical Hit/challenge_text.md diff --git a/Easy Challenges/Challenge #271 [Easy] Critical Hit/solutions/solution.c b/Easy Challenges/Challenge 0271 Easy - Critical Hit/solutions/solution.c similarity index 100% rename from Easy Challenges/Challenge #271 [Easy] Critical Hit/solutions/solution.c rename to Easy Challenges/Challenge 0271 Easy - Critical Hit/solutions/solution.c diff --git a/Easy Challenges/Challenge #272 [Easy] What's in the bag/challenge_text.md b/Easy Challenges/Challenge 0272 Easy - What's in the bag/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #272 [Easy] What's in the bag/challenge_text.md rename to Easy Challenges/Challenge 0272 Easy - What's in the bag/challenge_text.md diff --git a/Easy Challenges/Challenge #272 [Easy] What's in the bag/solutions/solution.py b/Easy Challenges/Challenge 0272 Easy - What's in the bag/solutions/solution.py similarity index 100% rename from Easy Challenges/Challenge #272 [Easy] What's in the bag/solutions/solution.py rename to Easy Challenges/Challenge 0272 Easy - What's in the bag/solutions/solution.py diff --git a/Easy Challenges/Challenge #273 [Easy] Getting a degree/challenge_text.md b/Easy Challenges/Challenge 0273 Easy - Getting a degree/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #273 [Easy] Getting a degree/challenge_text.md rename to Easy Challenges/Challenge 0273 Easy - Getting a degree/challenge_text.md diff --git a/Easy Challenges/Challenge #275 [Easy] Splurthian Chemistry 101/challenge_text.md b/Easy Challenges/Challenge 0275 Easy - Splurthian Chemistry 101/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #275 [Easy] Splurthian Chemistry 101/challenge_text.md rename to Easy Challenges/Challenge 0275 Easy - Splurthian Chemistry 101/challenge_text.md diff --git a/Easy Challenges/Challenge #275 [Easy] Splurthian Chemistry 101/solutions/solution.c b/Easy Challenges/Challenge 0275 Easy - Splurthian Chemistry 101/solutions/solution.c similarity index 100% rename from Easy Challenges/Challenge #275 [Easy] Splurthian Chemistry 101/solutions/solution.c rename to Easy Challenges/Challenge 0275 Easy - Splurthian Chemistry 101/solutions/solution.c diff --git a/Easy Challenges/Challenge #276 [Easy] Recktangles/challenge_text.md b/Easy Challenges/Challenge 0276 Easy - Recktangles/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #276 [Easy] Recktangles/challenge_text.md rename to Easy Challenges/Challenge 0276 Easy - Recktangles/challenge_text.md diff --git a/Easy Challenges/Challenge #276 [Easy] Recktangles/solutions/solution.py b/Easy Challenges/Challenge 0276 Easy - Recktangles/solutions/solution.py similarity index 100% rename from Easy Challenges/Challenge #276 [Easy] Recktangles/solutions/solution.py rename to Easy Challenges/Challenge 0276 Easy - Recktangles/solutions/solution.py diff --git a/Easy Challenges/Challenge #277 [Easy] Simplifying fractions/challenge_text.md b/Easy Challenges/Challenge 0277 Easy - Simplifying fractions/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #277 [Easy] Simplifying fractions/challenge_text.md rename to Easy Challenges/Challenge 0277 Easy - Simplifying fractions/challenge_text.md diff --git a/Easy Challenges/Challenge #278 [EasyMed] Weave insert Part 1/challenge_text.md b/Easy Challenges/Challenge 0278 Easy - Weave insert Part 1/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #278 [EasyMed] Weave insert Part 1/challenge_text.md rename to Easy Challenges/Challenge 0278 Easy - Weave insert Part 1/challenge_text.md diff --git a/Easy Challenges/Challenge #279 [Easy] Uuencoding/challenge_text.md b/Easy Challenges/Challenge 0279 Easy - Uuencoding/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #279 [Easy] Uuencoding/challenge_text.md rename to Easy Challenges/Challenge 0279 Easy - Uuencoding/challenge_text.md diff --git a/Easy Challenges/Challenge #280 [Easy] 0 to 100, Real Quick/challenge_text.md b/Easy Challenges/Challenge 0280 Easy - 0 to 100, Real Quick/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #280 [Easy] 0 to 100, Real Quick/challenge_text.md rename to Easy Challenges/Challenge 0280 Easy - 0 to 100, Real Quick/challenge_text.md diff --git a/Easy Challenges/Challenge #281 [Easy] Something about bases/challenge_text.md b/Easy Challenges/Challenge 0281 Easy - Something about bases/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #281 [Easy] Something about bases/challenge_text.md rename to Easy Challenges/Challenge 0281 Easy - Something about bases/challenge_text.md diff --git a/Easy Challenges/Challenge #282 [Easy] Unusual Bases/challenge_text.md b/Easy Challenges/Challenge 0282 Easy - Unusual Bases/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #282 [Easy] Unusual Bases/challenge_text.md rename to Easy Challenges/Challenge 0282 Easy - Unusual Bases/challenge_text.md diff --git a/Easy Challenges/Challenge #283 [Easy] Anagram Detector/challenge_text.md b/Easy Challenges/Challenge 0283 Easy - Anagram Detector/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #283 [Easy] Anagram Detector/challenge_text.md rename to Easy Challenges/Challenge 0283 Easy - Anagram Detector/challenge_text.md diff --git a/Easy Challenges/Challenge #284 [Easy] Wandering Fingers/challenge_text.md b/Easy Challenges/Challenge 0284 Easy - Wandering Fingers/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #284 [Easy] Wandering Fingers/challenge_text.md rename to Easy Challenges/Challenge 0284 Easy - Wandering Fingers/challenge_text.md diff --git a/Easy Challenges/Challenge #285 [Easy] Cross PlatformLanguage Data Encoding part 1/challenge_text.md b/Easy Challenges/Challenge 0285 Easy - Cross PlatformLanguage Data Encoding part 1/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #285 [Easy] Cross PlatformLanguage Data Encoding part 1/challenge_text.md rename to Easy Challenges/Challenge 0285 Easy - Cross PlatformLanguage Data Encoding part 1/challenge_text.md diff --git a/Easy Challenges/Challenge #286 [Easy] Reverse Factorial/challenge_text.md b/Easy Challenges/Challenge 0286 Easy - Reverse Factorial/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #286 [Easy] Reverse Factorial/challenge_text.md rename to Easy Challenges/Challenge 0286 Easy - Reverse Factorial/challenge_text.md diff --git a/Easy Challenges/Challenge #286 [Easy] Reverse Factorial/solutions/solution.py b/Easy Challenges/Challenge 0286 Easy - Reverse Factorial/solutions/solution.py similarity index 100% rename from Easy Challenges/Challenge #286 [Easy] Reverse Factorial/solutions/solution.py rename to Easy Challenges/Challenge 0286 Easy - Reverse Factorial/solutions/solution.py diff --git a/Easy Challenges/Challenge #287 [Easy] Kaprekar's Routine/challenge_text.md b/Easy Challenges/Challenge 0287 Easy - Kaprekar's Routine/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #287 [Easy] Kaprekar's Routine/challenge_text.md rename to Easy Challenges/Challenge 0287 Easy - Kaprekar's Routine/challenge_text.md diff --git a/Easy Challenges/Challenge #287 [Easy] Kaprekar's Routine/solutions/solution.c b/Easy Challenges/Challenge 0287 Easy - Kaprekar's Routine/solutions/solution.c similarity index 100% rename from Easy Challenges/Challenge #287 [Easy] Kaprekar's Routine/solutions/solution.c rename to Easy Challenges/Challenge 0287 Easy - Kaprekar's Routine/solutions/solution.c diff --git a/Easy Challenges/Challenge #288 [Easy] Detecting Alliteration/challenge_text.md b/Easy Challenges/Challenge 0288 Easy - Detecting Alliteration/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #288 [Easy] Detecting Alliteration/challenge_text.md rename to Easy Challenges/Challenge 0288 Easy - Detecting Alliteration/challenge_text.md diff --git a/Easy Challenges/Challenge #289 [Easy] It's super effective!/challenge_text.md b/Easy Challenges/Challenge 0289 Easy - It's super effective!/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #289 [Easy] It's super effective!/challenge_text.md rename to Easy Challenges/Challenge 0289 Easy - It's super effective!/challenge_text.md diff --git a/Easy Challenges/Challenge #290 [Easy] Kaprekar Numbers/challenge_text.md b/Easy Challenges/Challenge 0290 Easy - Kaprekar Numbers/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #290 [Easy] Kaprekar Numbers/challenge_text.md rename to Easy Challenges/Challenge 0290 Easy - Kaprekar Numbers/challenge_text.md diff --git a/Easy Challenges/Challenge #291 [Easy] Goldilocks' Bear Necessities/challenge_text.md b/Easy Challenges/Challenge 0291 Easy - Goldilocks' Bear Necessities/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #291 [Easy] Goldilocks' Bear Necessities/challenge_text.md rename to Easy Challenges/Challenge 0291 Easy - Goldilocks' Bear Necessities/challenge_text.md diff --git a/Easy Challenges/Challenge #292 [Easy] Increasing range parsing/challenge_text.md b/Easy Challenges/Challenge 0292 Easy - Increasing range parsing/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #292 [Easy] Increasing range parsing/challenge_text.md rename to Easy Challenges/Challenge 0292 Easy - Increasing range parsing/challenge_text.md diff --git a/Easy Challenges/Challenge #293 [Easy] Defusing the bomb/challenge_text.md b/Easy Challenges/Challenge 0293 Easy - Defusing the bomb/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #293 [Easy] Defusing the bomb/challenge_text.md rename to Easy Challenges/Challenge 0293 Easy - Defusing the bomb/challenge_text.md diff --git a/Easy Challenges/Challenge #294 [Easy] Rack management 1/challenge_text.md b/Easy Challenges/Challenge 0294 Easy - Rack management 1/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #294 [Easy] Rack management 1/challenge_text.md rename to Easy Challenges/Challenge 0294 Easy - Rack management 1/challenge_text.md diff --git a/Easy Challenges/Challenge #295 [Easy] Letter by letter/challenge_text.md b/Easy Challenges/Challenge 0295 Easy - Letter by letter/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #295 [Easy] Letter by letter/challenge_text.md rename to Easy Challenges/Challenge 0295 Easy - Letter by letter/challenge_text.md diff --git a/Easy Challenges/Challenge #296 [Easy] The Twelve Days of.../challenge_text.md b/Easy Challenges/Challenge 0296 Easy - The Twelve Days of.../challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #296 [Easy] The Twelve Days of.../challenge_text.md rename to Easy Challenges/Challenge 0296 Easy - The Twelve Days of.../challenge_text.md diff --git a/Easy Challenges/Challenge #298 [Easy] Too many Parentheses/challenge_text.md b/Easy Challenges/Challenge 0298 Easy - Too many Parentheses/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #298 [Easy] Too many Parentheses/challenge_text.md rename to Easy Challenges/Challenge 0298 Easy - Too many Parentheses/challenge_text.md diff --git a/Easy Challenges/Challenge #300 [EasyIntermediate] Let's make some noise part 2/challenge_text.md b/Easy Challenges/Challenge 0300 Easy - Let's make some noise part 2/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #300 [EasyIntermediate] Let's make some noise part 2/challenge_text.md rename to Easy Challenges/Challenge 0300 Easy - Let's make some noise part 2/challenge_text.md diff --git a/Easy Challenges/Challenge #300 [Easy] Let's make some noise/challenge_text.md b/Easy Challenges/Challenge 0300 Easy - Let's make some noise/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #300 [Easy] Let's make some noise/challenge_text.md rename to Easy Challenges/Challenge 0300 Easy - Let's make some noise/challenge_text.md diff --git a/Easy Challenges/Challenge #301 [EasyIntemerdiate] Looking for patterns/challenge_text.md b/Easy Challenges/Challenge 0301 Easy - Looking for patterns/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #301 [EasyIntemerdiate] Looking for patterns/challenge_text.md rename to Easy Challenges/Challenge 0301 Easy - Looking for patterns/challenge_text.md diff --git a/Easy Challenges/Challenge #302 [Easy] Spelling with Chemistry/challenge_text.md b/Easy Challenges/Challenge 0302 Easy - Spelling with Chemistry/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #302 [Easy] Spelling with Chemistry/challenge_text.md rename to Easy Challenges/Challenge 0302 Easy - Spelling with Chemistry/challenge_text.md diff --git a/Easy Challenges/Challenge #303 [Easy] Ricochet/challenge_text.md b/Easy Challenges/Challenge 0303 Easy - Ricochet/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #303 [Easy] Ricochet/challenge_text.md rename to Easy Challenges/Challenge 0303 Easy - Ricochet/challenge_text.md diff --git a/Easy Challenges/Challenge #304 [Easy] Little Accountant/challenge_text.md b/Easy Challenges/Challenge 0304 Easy - Little Accountant/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #304 [Easy] Little Accountant/challenge_text.md rename to Easy Challenges/Challenge 0304 Easy - Little Accountant/challenge_text.md diff --git a/Easy Challenges/Challenge #305 [Easy] Permutation base/challenge_text.md b/Easy Challenges/Challenge 0305 Easy - Permutation base/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #305 [Easy] Permutation base/challenge_text.md rename to Easy Challenges/Challenge 0305 Easy - Permutation base/challenge_text.md diff --git a/Easy Challenges/Challenge #306 [Easy] Pandigital Roman Numbers/challenge_text.md b/Easy Challenges/Challenge 0306 Easy - Pandigital Roman Numbers/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #306 [Easy] Pandigital Roman Numbers/challenge_text.md rename to Easy Challenges/Challenge 0306 Easy - Pandigital Roman Numbers/challenge_text.md diff --git a/Easy Challenges/Challenge #307 [Easy] base 255 part1/challenge_text.md b/Easy Challenges/Challenge 0307 Easy - base 255 part1/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #307 [Easy] base 255 part1/challenge_text.md rename to Easy Challenges/Challenge 0307 Easy - base 255 part1/challenge_text.md diff --git a/Easy Challenges/Challenge #308 [Easy] Let it burn/challenge_text.md b/Easy Challenges/Challenge 0308 Easy - Let it burn/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #308 [Easy] Let it burn/challenge_text.md rename to Easy Challenges/Challenge 0308 Easy - Let it burn/challenge_text.md diff --git a/Easy Challenges/Challenge #310 [Easy] Kids Lotto/challenge_text.md b/Easy Challenges/Challenge 0310 Easy - Kids Lotto/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #310 [Easy] Kids Lotto/challenge_text.md rename to Easy Challenges/Challenge 0310 Easy - Kids Lotto/challenge_text.md diff --git a/Easy Challenges/Challenge #311 [Easy] Jolly Jumper/challenge_text.md b/Easy Challenges/Challenge 0311 Easy - Jolly Jumper/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #311 [Easy] Jolly Jumper/challenge_text.md rename to Easy Challenges/Challenge 0311 Easy - Jolly Jumper/challenge_text.md diff --git a/Easy Challenges/Challenge #312 [Easy] L33tspeak Translator/challenge_text.md b/Easy Challenges/Challenge 0312 Easy - L33tspeak Translator/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #312 [Easy] L33tspeak Translator/challenge_text.md rename to Easy Challenges/Challenge 0312 Easy - L33tspeak Translator/challenge_text.md diff --git a/Easy Challenges/Challenge #313 [Easy] Subset sum/challenge_text.md b/Easy Challenges/Challenge 0313 Easy - Subset sum/challenge_text.md similarity index 100% rename from Easy Challenges/Challenge #313 [Easy] Subset sum/challenge_text.md rename to Easy Challenges/Challenge 0313 Easy - Subset sum/challenge_text.md diff --git a/Easy Challenges/Challenge 0314 Easy - Concatenated Integers/challenge_text.md b/Easy Challenges/Challenge 0314 Easy - Concatenated Integers/challenge_text.md new file mode 100644 index 0000000..d0d9952 --- /dev/null +++ b/Easy Challenges/Challenge 0314 Easy - Concatenated Integers/challenge_text.md @@ -0,0 +1,33 @@ +# Description + +Given a list of integers separated by a single space on standard input, print out the largest and smallest values that can be obtained by concatenating the integers together on their own line. This is from [Five programming problems every Software Engineer should be able to solve in less than 1 hour](http://www.shiftedup.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour), problem 4. Leading 0s are not allowed (e.g. 01234 is not a valid entry). + +This is an easier version of [#312I](https://www.reddit.com/r/dailyprogrammer/comments/67q3s6/20170426_challenge_312_intermediate_next_largest/?utm_content=title&utm_medium=hot&utm_source=reddit&utm_name=dailyprogrammer). + +# Sample Input + +You'll be given a handful of integers per line. Example: + + 5 56 50 + +# Sample Output + +You should emit the smallest and largest integer you can make, per line. Example: + + 50556 56550 + +# Challenge Input + + 79 82 34 83 69 + 420 34 19 71 341 + 17 32 91 7 46 + +# Challenge Output + + 3469798283 8382796934 + 193413442071 714203434119 + 173246791 917463217 + +# Bonus + +**EDIT** My solution uses permutations, which is inefficient. Try and come up with a more efficient approach. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0315 Easy - XOR Multiplication/challenge_text.md b/Easy Challenges/Challenge 0315 Easy - XOR Multiplication/challenge_text.md new file mode 100644 index 0000000..ca1018d --- /dev/null +++ b/Easy Challenges/Challenge 0315 Easy - XOR Multiplication/challenge_text.md @@ -0,0 +1,68 @@ +# Description + +One way to think about bitwise *addition* (using the symbol `^`) as binary addition without carrying the extra bits: + + 101 5 + ^ 1001 9 + ---- + 1100 12 + + 5^9=12 + +So let's define XOR multiplcation (we'll use the symbol `@`) in the same way, the addition step doesn't carry: + + 1110 14 + @ 1101 13 + ----- + 1110 + 0 + 1110 + ^ 1110 + ------ + 1000110 70 + + 14@13=70 + +For this challenge you'll get two non-negative integers as input and output or print their XOR-product, using both binary and decimal notation. + +# Input Description + +You'll be given two integers per line. Example: + + 5 9 + +# Output Description + +You should emit the equation showing the XOR multiplcation result: + + 5@9=45 + +**EDIT** I had it as `12` earlier, but that was a copy-paste error. Fixed. + +# Challenge Input + + 1 2 + 9 0 + 6 1 + 3 3 + 2 5 + 7 9 + 13 11 + 5 17 + 14 13 + 19 1 + 63 63 + +# Challenge Output + + 1@2=2 + 9@0=0 + 6@1=6 + 3@3=5 + 2@5=10 + 7@9=63 + 13@11=127 + 5@17=85 + 14@13=70 + 19@1=19 + 63@63=1365 diff --git a/Easy Challenges/Challenge 0316 Easy - Knight's Metric/challenge_text.md b/Easy Challenges/Challenge 0316 Easy - Knight's Metric/challenge_text.md new file mode 100644 index 0000000..a2cb067 --- /dev/null +++ b/Easy Challenges/Challenge 0316 Easy - Knight's Metric/challenge_text.md @@ -0,0 +1,28 @@ +# Description + +A knight piece in chess can only make L-shaped moves. Specifically, it can only move x steps to the right and y steps up if (x,y) is one of: + + (-1,-2) ( 1,-2) (-1, 2) ( 1, 2) + (-2,-1) ( 2,-1) (-2, 1) ( 2, 1) + +(For this problem, assume the board extends infinitely in all directions, so a knight may always make eight moves from any starting point.) A knight starting from (0,0) can reach any square, but it may have to take a roundabout route. For instance, to reach the square (0,1) requires three steps: + + 2, 1 + -1, 2 + -1, -2 + +(Notice that the x's add up to 0, and the y's add up to 1.) Write a program, that, given a square (x,y), returns how many moves it takes a knight to reach that square starting from (0,0). + +# Example Input + + 3 7 + +# Example Output + + 4 + +Optional: also output one route the knight could take to reach this square. + +# Credit + +This challenge was suggested by /u/Cosmologicon, a well-known moderator of this sub. Many thanks! This one was hiding in the archives ... \ No newline at end of file diff --git a/Easy Challenges/Challenge 0317 Easy - Collatz Tag System/challenge_text.md b/Easy Challenges/Challenge 0317 Easy - Collatz Tag System/challenge_text.md new file mode 100644 index 0000000..b3d8bd4 --- /dev/null +++ b/Easy Challenges/Challenge 0317 Easy - Collatz Tag System/challenge_text.md @@ -0,0 +1,345 @@ + +# Description + +Implement the [Collatz Conjecture tag system described here](https://en.wikipedia.org/wiki/Tag_system#Example:_Computation_of_Collatz_sequences) + +# Input Description + +A string of n *a*'s + +# Output Description + +Print the string at each step. The last line should be "*a*" (assuming the Collatz conjecture) + +# Challenge Input + + + aaa + aaaaa + +# Challenge Output + +aaa + + abc + cbc + caaa + aaaaa + aaabc + abcbc + cbcbc + cbcaaa + caaaaaa + aaaaaaaa + aaaaaabc + aaaabcbc + aabcbcbc + bcbcbcbc + bcbcbca + bcbcaa + bcaaa + aaaa + aabc + bcbc + bca + aa + bc + a + +aaaaaaa + + aaaaabc + aaabcbc + abcbcbc + cbcbcbc + cbcbcaaa + cbcaaaaaa + caaaaaaaaa + aaaaaaaaaaa + aaaaaaaaabc + aaaaaaabcbc + aaaaabcbcbc + aaabcbcbcbc + abcbcbcbcbc + cbcbcbcbcbc + cbcbcbcbcaaa + cbcbcbcaaaaaa + cbcbcaaaaaaaaa + cbcaaaaaaaaaaaa + caaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaabc + aaaaaaaaaaaaabcbc + aaaaaaaaaaabcbcbc + aaaaaaaaabcbcbcbc + aaaaaaabcbcbcbcbc + aaaaabcbcbcbcbcbc + aaabcbcbcbcbcbcbc + abcbcbcbcbcbcbcbc + cbcbcbcbcbcbcbcbc + cbcbcbcbcbcbcbcaaa + cbcbcbcbcbcbcaaaaaa + cbcbcbcbcbcaaaaaaaaa + cbcbcbcbcaaaaaaaaaaaa + cbcbcbcaaaaaaaaaaaaaaa + cbcbcaaaaaaaaaaaaaaaaaa + cbcaaaaaaaaaaaaaaaaaaaaa + caaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaabc + aaaaaaaaaaaaaaaaaaaaaabcbc + aaaaaaaaaaaaaaaaaaaabcbcbc + aaaaaaaaaaaaaaaaaabcbcbcbc + aaaaaaaaaaaaaaaabcbcbcbcbc + aaaaaaaaaaaaaabcbcbcbcbcbc + aaaaaaaaaaaabcbcbcbcbcbcbc + aaaaaaaaaabcbcbcbcbcbcbcbc + aaaaaaaabcbcbcbcbcbcbcbcbc + aaaaaabcbcbcbcbcbcbcbcbcbc + aaaabcbcbcbcbcbcbcbcbcbcbc + aabcbcbcbcbcbcbcbcbcbcbcbc + bcbcbcbcbcbcbcbcbcbcbcbcbc + bcbcbcbcbcbcbcbcbcbcbcbca + bcbcbcbcbcbcbcbcbcbcbcaa + bcbcbcbcbcbcbcbcbcbcaaa + bcbcbcbcbcbcbcbcbcaaaa + bcbcbcbcbcbcbcbcaaaaa + bcbcbcbcbcbcbcaaaaaa + bcbcbcbcbcbcaaaaaaa + bcbcbcbcbcaaaaaaaa + bcbcbcbcaaaaaaaaa + bcbcbcaaaaaaaaaa + bcbcaaaaaaaaaaa + bcaaaaaaaaaaaa + aaaaaaaaaaaaa + aaaaaaaaaaabc + aaaaaaaaabcbc + aaaaaaabcbcbc + aaaaabcbcbcbc + aaabcbcbcbcbc + abcbcbcbcbcbc + cbcbcbcbcbcbc + cbcbcbcbcbcaaa + cbcbcbcbcaaaaaa + cbcbcbcaaaaaaaaa + cbcbcaaaaaaaaaaaa + cbcaaaaaaaaaaaaaaa + caaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaabc + aaaaaaaaaaaaaaaabcbc + aaaaaaaaaaaaaabcbcbc + aaaaaaaaaaaabcbcbcbc + aaaaaaaaaabcbcbcbcbc + aaaaaaaabcbcbcbcbcbc + aaaaaabcbcbcbcbcbcbc + aaaabcbcbcbcbcbcbcbc + aabcbcbcbcbcbcbcbcbc + bcbcbcbcbcbcbcbcbcbc + bcbcbcbcbcbcbcbcbca + bcbcbcbcbcbcbcbcaa + bcbcbcbcbcbcbcaaa + bcbcbcbcbcbcaaaa + bcbcbcbcbcaaaaa + bcbcbcbcaaaaaa + bcbcbcaaaaaaa + bcbcaaaaaaaa + bcaaaaaaaaa + aaaaaaaaaa + aaaaaaaabc + aaaaaabcbc + aaaabcbcbc + aabcbcbcbc + bcbcbcbcbc + bcbcbcbca + bcbcbcaa + bcbcaaa + bcaaaa + aaaaa + aaabc + abcbc + cbcbc + cbcaaa + caaaaaa + aaaaaaaa + aaaaaabc + aaaabcbc + aabcbcbc + bcbcbcbc + bcbcbca + bcbcaa + bcaaa + aaaa + aabc + bcbc + bca + aa + bc + a + +# Notes/Hints + +The [Collatz Conjecture](https://en.wikipedia.org/wiki/3x_%2B_1_problem) + +If you're not familiar with tag systems, you can read the [Wikipedia article on them here](https://en.wikipedia.org/wiki/Tag_system) + + + +# Bonus + +Implement the same tag system as a cyclic tag system using the [schema described here](https://en.wikipedia.org/wiki/Tag_system#Emulation_of_tag_systems_by_cyclic_tag_systems) + +# Bonus Input + + 100100100 + +# Bonus Output + + 00100100010001 + 0100100010001 + 100100010001 + 00100010001 + 0100010001 + 100010001 + 00010001010001 + 0010001010001 + 010001010001 + 10001010001 + 0001010001 + 001010001 + 01010001 + 1010001 + 010001100100100 + 10001100100100 + 0001100100100 + 001100100100 + 01100100100 + 1100100100 + 100100100100100100 + 00100100100100100 + 0100100100100100 + 100100100100100 + 00100100100100010001 + 0100100100100010001 + 100100100100010001 + 00100100100010001 + 0100100100010001 + 100100100010001 + 00100100010001010001 + 0100100010001010001 + 100100010001010001 + 00100010001010001 + 0100010001010001 + 100010001010001 + 00010001010001010001 + 0010001010001010001 + 010001010001010001 + 10001010001010001 + 0001010001010001 + 001010001010001 + 01010001010001 + 1010001010001 + 010001010001100100100 + 10001010001100100100 + 0001010001100100100 + 001010001100100100 + 01010001100100100 + 1010001100100100 + 010001100100100100100100 + 10001100100100100100100 + 0001100100100100100100 + 001100100100100100100 + 01100100100100100100 + 1100100100100100100 + 100100100100100100100100100 + 00100100100100100100100100 + 0100100100100100100100100 + 100100100100100100100100 + 00100100100100100100100010001 + 0100100100100100100100010001 + 100100100100100100100010001 + 00100100100100100100010001 + 0100100100100100100010001 + 100100100100100100010001 + 00100100100100100010001010001 + 0100100100100100010001010001 + 100100100100100010001010001 + 00100100100100010001010001 + 0100100100100010001010001 + 100100100100010001010001 + 00100100100010001010001010001 + 0100100100010001010001010001 + 100100100010001010001010001 + 00100100010001010001010001 + 0100100010001010001010001 + 100100010001010001010001 + 00100010001010001010001010001 + 0100010001010001010001010001 + 100010001010001010001010001 + 00010001010001010001010001 + 0010001010001010001010001 + 010001010001010001010001 + 10001010001010001010001 + 0001010001010001010001100 + 001010001010001010001100 + 01010001010001010001100 + 1010001010001010001100 + 010001010001010001100 + 10001010001010001100 + 0001010001010001100100 + 001010001010001100100 + 01010001010001100100 + 1010001010001100100 + 010001010001100100 + 10001010001100100 + 0001010001100100100 + 001010001100100100 + 01010001100100100 + 1010001100100100 + 010001100100100 + 10001100100100 + 0001100100100100 + 001100100100100 + 01100100100100 + 1100100100100 + 100100100100 + 00100100100010001 + 0100100100010001 + 100100100010001 + 00100100010001 + 0100100010001 + 100100010001 + 00100010001010001 + 0100010001010001 + 100010001010001 + 00010001010001 + 0010001010001 + 010001010001 + 10001010001 + 0001010001100 + 001010001100 + 01010001100 + 1010001100 + 010001100 + 10001100 + 0001100100 + 001100100 + 01100100 + 1100100 + 100100 + 00100010001 + 0100010001 + 100010001 + 00010001 + 0010001 + 010001 + 10001 + 0001100 + 001100 + 01100 + 1100 + 100 + +# Credit + +This challenge was proposed by /u/thebutterflydefect, many thanks. If you have a challenge idea, please share it in /r/dailyprogrammer_ideas and there's a good chance we'll use it. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0318 Easy - Countdown Game Show/challenge_text.md b/Easy Challenges/Challenge 0318 Easy - Countdown Game Show/challenge_text.md new file mode 100644 index 0000000..ea52cf2 --- /dev/null +++ b/Easy Challenges/Challenge 0318 Easy - Countdown Game Show/challenge_text.md @@ -0,0 +1,49 @@ +# Description + +This challenge is based off the British tv game show "Countdown". The rules are pretty simple: Given a set of numbers X1-X5, calculate using mathematical operations to solve for Y. You can use addition, subtraction, multiplication, or division. + +Unlike "real math", the standard order of operations (PEMDAS) is not applied here. Instead, the order is determined left to right. + +# Example Input + +The user should input any 6 whole numbers and the target number. E.g. + + 1 3 7 6 8 3 250 + +# Example Output + +The output should be the order of numbers and operations that will compute the target number. E.g. + + 3+8*7+6*3+1=250 + +Note that if follow PEMDAS you get: + + 3+8*7+6*3+1 = 78 + +But remember our rule - go left to right and operate. So the solution is found by: + + (((((3+8)*7)+6)*3)+1) = 250 + +If you're into functional progamming, this is essentially a *fold* to the right using the varied operators. + +# Challenge Input + + 25 100 9 7 3 7 881 + + 6 75 3 25 50 100 952 + +# Challenge Output + + 7 * 3 + 100 * 7 + 25 + 9 = 881 + + 100 + 6 * 3 * 75 - 50 / 25 = 952 + +# Notes about Countdown + +Since Countdown's debut in 1982, there have been over 6,500 televised games and 75 complete series. There have also been fourteen Champion of Champions tournaments, with the most recent starting in January 2016. + +On 5 September 2014, Countdown received a Guinness World Record at the end of its 6,000th show for the longest-running television programme of its kind during the course of its 71st series. + +# Credit + +This challenge was suggested by user /u/MoistedArnoldPalmer, many thanks. Furthermore, /u/JakDrako highlighted the difference in the order of operations that clarifies this problem significantly. Thanks to both of them. If you have a challenge idea, please share it in /r/dailyprogrammer_ideas and there's a good chance we'll use it. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0319 Easy - Condensing Sentences/challenge_text.md b/Easy Challenges/Challenge 0319 Easy - Condensing Sentences/challenge_text.md new file mode 100644 index 0000000..c68362a --- /dev/null +++ b/Easy Challenges/Challenge 0319 Easy - Condensing Sentences/challenge_text.md @@ -0,0 +1,29 @@ +# Description + +Compression makes use of the fact that repeated structures are redundant, and it's more efficient to represent the pattern and the count or a reference to it. Siimilarly, we can *condense* a sentence by using the redundancy of overlapping letters from the end of one word and the start of the next. In this manner we can reduce the size of the sentence, even if we start to lose meaning. + +For instance, the phrase "live verses" can be condensed to "liverses". + +In this challenge you'll be asked to write a tool to condense sentences. + +# Input Description + +You'll be given a sentence, one per line, to condense. Condense where you can, but know that you can't condense everywhere. Example: + + I heard the pastor sing live verses easily. + +# Output Description + +Your program should emit a sentence with the appropriate parts condensed away. Our example: + + I heard the pastor sing liverses easily. + +# Challenge Input + + Deep episodes of Deep Space Nine came on the television only after the news. + Digital alarm clocks scare area children. + +# Challenge Output + + Deepisodes of Deep Space Nine came on the televisionly after the news. + Digitalarm clockscarea children. diff --git a/Easy Challenges/Challenge 0320 Easy - Spiral Ascension/challenge_text.md b/Easy Challenges/Challenge 0320 Easy - Spiral Ascension/challenge_text.md new file mode 100644 index 0000000..f7627fd --- /dev/null +++ b/Easy Challenges/Challenge 0320 Easy - Spiral Ascension/challenge_text.md @@ -0,0 +1,42 @@ +# Description + +The user enters a number. Make a spiral that begins with 1 and starts from the top left, going towards the right, and ends with the square of that number. + +# Input description + +Let the user enter a number. + +# Output description + +Note the proper spacing in the below example. You'll need to know the number of digits in the biggest number. + +You may go for a CLI version or GUI version. + +# Challenge Input + + 5 + + 4 + +# Challenge Output + + 1 2 3 4 5 + 16 17 18 19 6 + 15 24 25 20 7 + 14 23 22 21 8 + 13 12 11 10 9 + + + + 1 2 3 4 + 12 13 14 5 + 11 16 15 6 + 10 9 8 7 + +# Bonus + +As a bonus, the code could take a parameter and make a clockwise or counter-clockwise spiral. + +# Credit + +This challenge was suggested by /u/MasterAgent47 (with a bonus suggested by /u/JakDrako), many thanks to them both. If you would like, submit to /r/dailyprogrammer_ideas if you have any challenge ideas! \ No newline at end of file diff --git a/Easy Challenges/Challenge 0321 Easy - Talking Clock/challenge_text.md b/Easy Challenges/Challenge 0321 Easy - Talking Clock/challenge_text.md new file mode 100644 index 0000000..8f4f1f0 --- /dev/null +++ b/Easy Challenges/Challenge 0321 Easy - Talking Clock/challenge_text.md @@ -0,0 +1,39 @@ + +**Description** + +No more hiding from your alarm clock! You've decided you want your computer to keep you updated on the time so you're never late again. A talking clock takes a 24-hour time and translates it into words. + + +**Input Description** + +An hour (0-23) followed by a colon followed by the minute (0-59). + + +**Output Description** + +The time in words, using 12-hour format followed by am or pm. + + +**Sample Input data** + + 00:00 + 01:30 + 12:05 + 14:01 + 20:29 + 21:00 + + +**Sample Output data** + + It's twelve am + It's one thirty am + It's twelve oh five pm + It's two oh one pm + It's eight twenty nine pm + It's nine pm + + +**Extension challenges (optional)** + +Use the audio clips [found here](http://steve-audio.net/voices/) to give your clock a voice. diff --git a/Easy Challenges/Challenge 0322 Easy - All Pairs Test Generator/challenge_text.md b/Easy Challenges/Challenge 0322 Easy - All Pairs Test Generator/challenge_text.md new file mode 100644 index 0000000..dcb234a --- /dev/null +++ b/Easy Challenges/Challenge 0322 Easy - All Pairs Test Generator/challenge_text.md @@ -0,0 +1,55 @@ +# Description + +In the world of software testing there is a combinatorial shortcut to exhaustive testing called "All Pairs" or "Pairwise Testing". The gist of this kind of testing is based on some old research that found for a given scenario^1 -- a web form, for example -- most errors were caused either by 1 element, or the interaction of a pair of elements. So, rather than test every single combination of possible inputs, if you carefully chose your test cases so that each possible combination of 2 elements appeared at least once in the test cases, then you'd encounter the majority of the problems. This is helpful because for a form with many inputs, the exhaustive list of combinations can be quite large, but doing all-pairs testing can reduce the list quite drastically. + + +Say on our hypothetical web form, we have a checkbox and two dropdowns. + +* The checkbox can only have two values: 0 or 1 +* The first dropdown can have three values: A B or C +* The second dropdown can have four values: D E F or G + +For this form, the total number of possible combinations is 2 x 3 x 4 = 24. But if we apply all pairs, we can reduce the number of tests to 12: + + 0 A G + 0 B G + 0 C D + 0 C E + 0 C F + 1 A D + 1 A E + 1 A F + 1 B D + 1 B E + 1 B F + 1 C G + +**Note**: Depending on how you generate the set, there can be more than one solution, but a proper answer must satisfy the conditions that **each member of the set must contain at least one pair which does not appear anywhere else in the set, and all possible pairs of inputs are represented somewhere in the set.** For example, the first member of the set above, 0AG contains the pairs '0A' and 'AG' which are not represented anywhere else in the set. The second member, '0BG' contains 'OG' and 'BG' which are not represented elsewhere. And so on and so forth. + +So, the challenge is, given a set of possible inputs, e.g. `[['0', '1'], ['A', 'B', 'C'], ['D', 'E', 'F', 'G']]` output a valid all-pairs set such that the conditions in bold above is met. + + ^1 There are some restrictions as to where this is applicable. + +# Challenge Inputs + + [['0', '1'], ['A', 'B', 'C'], ['D', 'E', 'F', 'G']] + [['0', '1', '2', '3'], ['A', 'B', 'C', 'D'], ['E', 'F', 'G', 'H', 'I']] + [['0', '1', '2', '3', '4'], ['A', 'B', 'C', 'D', 'E'], ['F', 'G', 'H', 'I'], ['J', 'K', 'L']] + +# Challenge Outputs + +(Because there are multiple valid solutions, this is the length of the output set - bonus points if you find a valid set with a lower length than one of these answers.) + + 12 + 34 + 62 + +# Additional Reading + +[Wikipedia: All-pairs testing](https://en.wikipedia.org/wiki/All-pairs_testing) + +[DevelopSense](http://www.developsense.com/pairwiseTesting.html) -- for hints on how to generate the pairs, and more info on testing, its limitations and stuff + +# Credit + +This challenge was suggested by user /u/abyssalheaven, many thanks! If you have an idea for a challenge, please share it in /r/dailyprogrammer_ideas and there's a good chance we'll use it. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0323 Easy - 3SUM/challenge_text.md b/Easy Challenges/Challenge 0323 Easy - 3SUM/challenge_text.md new file mode 100644 index 0000000..cd38a47 --- /dev/null +++ b/Easy Challenges/Challenge 0323 Easy - 3SUM/challenge_text.md @@ -0,0 +1,41 @@ +# Description + +In computational complexity theory, the 3SUM problem asks if a given set of *n* real numbers contains three elements that sum to zero. A naive solution works in O(N^2) time, and research efforts have been exploring the lower complexity bound for some time now. + +# Input Example + +You will be given a list of integers, one set per line. Example: + + 9 -6 -5 9 8 3 -4 8 1 7 -4 9 -9 1 9 -9 9 4 -6 -8 + +# Output Example + +Your program should emit triplets of numbers that sum to 0. Example: + + -9 1 8 + -8 1 7 + -5 -4 9 + -5 1 4 + -4 1 3 + -4 -4 8 + +# Challenge Input + + 4 5 -1 -2 -7 2 -5 -3 -7 -3 1 + -1 -6 -3 -7 5 -8 2 -8 1 + -5 -1 -4 2 9 -9 -6 -1 -7 + +# Challenge Output + + -7 2 5 + -5 1 4 + -3 -2 5 + -3 -1 4 + -3 1 2 + + -7 2 5 + -6 1 5 + -3 1 2 + + -5 -4 9 + -1 -1 2 diff --git a/Easy Challenges/Challenge 0324 Easy - manual square root procedure (intermediate)/challenge_text.md b/Easy Challenges/Challenge 0324 Easy - manual square root procedure (intermediate)/challenge_text.md new file mode 100644 index 0000000..2f0bb33 --- /dev/null +++ b/Easy Challenges/Challenge 0324 Easy - manual square root procedure (intermediate)/challenge_text.md @@ -0,0 +1,23 @@ +Write a program that outputs the highest number that is lower or equal than the square root of the given number, with the given number of decimal fraction digits. + +Use this technique, (do not use your language's built in square root function): https://medium.com/i-math/how-to-find-square-roots-by-hand-f3f7cadf94bb + +**input format: 2 numbers:** precision-digits Number + +**sample input** + +0 7720.17 +1 7720.17 +2 7720.17 + +**sample output** + +87 +87.8 +87.86 + +**challenge inputs** + +0 12345 +8 123456 +1 12345678901234567890123456789 \ No newline at end of file diff --git a/Easy Challenges/Challenge 0325 Easy - Color maze/challenge_text.md b/Easy Challenges/Challenge 0325 Easy - Color maze/challenge_text.md new file mode 100644 index 0000000..f2017b0 --- /dev/null +++ b/Easy Challenges/Challenge 0325 Easy - Color maze/challenge_text.md @@ -0,0 +1,99 @@ +#Description + +Today we are going to do something colorfull and amazing. Yes it is a color maze :D (you can downvote me now, it was totally worth it). + +You traverse a color by following a sequence of colors. For example [this maze](http://imgur.com/AnK1kwa) can be solved by the sequence 'orange -> green'. +Then you would have something like [this](http://imgur.com/zgciqa5) (paint skills) + +For the mazes you always pick a spot on the bottom, in the starting color and try to get to the first row. Once you reach the first row, you are out of the maze. The sequence does not have to be complete. + +You can move horizontally and vertically, but not diagonally. It is also allowed to move on the same node more then once. + +#Formal Inputs & Outputs + +##Input description + +You will recieve a line with the sequence to follow and all the lines after that are the maze. + + O G + B O R O Y + O R B G R + B O G O Y + Y G B Y G + R O R B R + +##Output description + +You can choose what you want to output: + +you could output the path: + + (1,4) + (1,3) + (1,2) + (2,2) + (3,2) + (3,1) + (3,0) + +or you could plot out the sequence + + / / / O / + / / / G / + / O G O / + / G / / / + / O / / / + +or you could create an image result or go even fancier if you want to. + + +##Challnge Input + + R O Y P O + R R B R R R B P Y G P B B B G P B P P R + B G Y P R P Y Y O R Y P P Y Y R R R P P + B P G R O P Y G R Y Y G P O R Y P B O O + R B B O R P Y O O Y R P B R G R B G P G + R P Y G G G P Y P Y O G B O R Y P B Y O + O R B G B Y B P G R P Y R O G Y G Y R P + B G O O O G B B R O Y Y Y Y P B Y Y G G + P P G B O P Y G B R O G B G R O Y R B R + Y Y P P R B Y B P O O G P Y R P P Y R Y + P O O B B B G O Y G O P B G Y R R Y R B + P P Y R B O O R O R Y B G B G O O P B Y + B B R G Y G P Y G P R R P Y G O O Y R R + O G R Y B P Y O P B R Y B G P G O O B P + R Y G P G G O R Y O O G R G P P Y P B G + P Y P R O O R O Y R P O R Y P Y B B Y R + O Y P G R P R G P O B B R B O B Y Y B P + B Y Y P O Y O Y O R B R G G Y G R G Y G + Y B Y Y G B R R O B O P P O B O R R R P + P O O O P Y G G Y P O G P O B G P R P B + R B B R R R R B B B Y O B G P G G O O Y + +#Notes/Hints + +Since the sequence can have the same color more then once, it is possible that you have to visit the same node more then once. + +#Bonus + +Read the data not from text input but from the [image](http://imgur.com/uoItN6T) + +All squares are 100 by 100 pixels with 1 pixel border + +The RGB values are + + Red: (255, 0, 0) + Green: (0,128,0) + Blue: (0, 0, 255) + Orange: (255, 165, 0) + Yellow: (255, 255, 0) + Pink: (255, 192, 203) + +#Finally + +Have a good challenge idea? + +Consider submitting it to /r/dailyprogrammer_ideas + +EDIT: Added clarifications after some questions of /u/the_droide \ No newline at end of file diff --git a/Easy Challenges/Challenge 0326 Easy - Nearest Prime Numbers/challenge_text.md b/Easy Challenges/Challenge 0326 Easy - Nearest Prime Numbers/challenge_text.md new file mode 100644 index 0000000..df5a996 --- /dev/null +++ b/Easy Challenges/Challenge 0326 Easy - Nearest Prime Numbers/challenge_text.md @@ -0,0 +1,43 @@ + +# Description + +A prime number is any integer greater than 1 which can only be evenly divided by 1 or itself. For this challenge, you will output two numbers: the nearest prime below the input, and the nearest prime above it. + +# Input Description + +The input will be a number on each line, called *n*. + +# Output Description + +The format of the output will be: +> *p1 < n < p2* + +where *p1* is the smaller prime, *p2* is the larger prime and *n* is the input. + +If *n* already is a prime, the output will be: +>*n* is prime. + +# Challenge Input + + 270 + 541 + 993 + 649 + +# Challenge Output + + 269 < 270 < 271 + 541 is prime. + 991 < 993 < 997 + 647 < 649 < 653 + +# Bonus + +Write the program to work for numbers with big gaps to the nearest primes. This requires a clever solution and cannot be efficiently bruteforced. + + 2010741 + 1425172824437700148 + +# Credit + +This challenge was suggested by user /u/tulanir, many thanks! If you have an idea for a challenge please share it on /r/dailyprogrammer_ideas and there's a good chance we'll use it. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0328 Easy - Latin Squares/challenge_text.md b/Easy Challenges/Challenge 0328 Easy - Latin Squares/challenge_text.md new file mode 100644 index 0000000..cd7f30a --- /dev/null +++ b/Easy Challenges/Challenge 0328 Easy - Latin Squares/challenge_text.md @@ -0,0 +1,72 @@ +#**Description** + +A [Latin square](https://en.wikipedia.org/wiki/Latin_square) is an n × n array filled with n different symbols, each occurring exactly once in each row and exactly once in each column. + + +For example: + +>1 + +And, + +>1 2 + +>2 1 + +Another one, + +>1 2 3 + +>3 1 2 + +>2 3 1 + +In this challenge, you have to check whether a given array is a Latin square. + +#**Input Description** + +Let the user enter the length of the array followed by *n x n* numbers. Fill an array from left to right starting from above. + +#**Output Description** + +If it is a Latin square, then display true. Else, display false. + +#**Challenge Input** + +> 5 + +> 1 2 3 4 5 5 1 2 3 4 4 5 1 2 3 3 4 5 1 2 2 3 4 5 1 + +> 2 + +> 1 3 3 4 + +> 4 + +> 1 2 3 4 1 3 2 4 2 3 4 1 4 3 2 1 + +#**Challenge Output** + +> true + +> false + +> false + +--------- + +#**Bonus** + +A Latin square is said to be reduced if both its first row and its first column are in their natural order. + +You can reduce a Latin square by reordering the rows and columns. The example in the description can be reduced to this + +>1 2 3 + +>2 3 1 + +>3 1 2 + +If a given array turns out to be a Latin square, then your program should reduce it and display it. + +Edit: /u/tomekanco has pointed out that many solutions which have an error. I shall look into this. Meanwhile, I have added an extra challenge input-output for you to check. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0329 Easy - Nearest Lucky Numbers/challenge_text.md b/Easy Challenges/Challenge 0329 Easy - Nearest Lucky Numbers/challenge_text.md new file mode 100644 index 0000000..e7a29b9 --- /dev/null +++ b/Easy Challenges/Challenge 0329 Easy - Nearest Lucky Numbers/challenge_text.md @@ -0,0 +1,81 @@ +#Description + +A [Lucky Number](https://en.wikipedia.org/wiki/Lucky_number) is a natural number in a set which is generated by a certain "sieve". This sieve is similar to the Sieve of Eratosthenes that generates the primes, but it eliminates numbers based on their position in the remaining set, instead of their value (or position in the initial set of natural numbers). + +The set of lucky numbers can be obtained by:- + + +Begin with a list of integers starting with 1: + +>1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 + +Starting with 1, remove every other element (i.e. every even number) from this set. We are left with: + +> 1 3 5 7 9 11 13 15 17 19 21 23 25 + +After 1, the next number in the set is **3**. So, remove every **3**rd number. Clearly, 5 is removed because it's the third number in the above set. Go on and keep removing every 3rd number. + +Your new set is: + +> 1 3 7 9 13 15 19 21 25... + +Here, the next remaining number you have after 3 is **7**. Now, at this point, it's obvious that there's no way 1 and 3 are ever getting eliminated. Thus, we can conclude that 1 and 3 are lucky numbers. + +Now remove every **7**th number. Clearly, 19 would be the first to be wiped out. + +You're left with: + +> 1 3 7 9 13 15 21 25 ... + +Now it's time to proceed to the next remaining number after 7, i.e., **9**. Remove every **9**th number. Note that at this point, 7 cannot be eliminated. 7 is a lucky number too. + +Keep proceeding in a similar fashion in order to get a list of lucky numbers. + +Numbers remaining after this procedure has been carried out completely are called lucky numbers. The first few are + +> 1, 3, 7, 9, 13, 15, 21, 25, 31, 33, 37, ... + +Today's challenge is to find the nearest lucky number. This might remind you of [Challenge #326](https://redd.it/6s70oh). In fact, this has been inspired from it. Bruteforcing is the most obvious option, but it's certainly not the most efficient. + +#Input Description + +The input will be a positive integer. + +#Output Description + +The output will be + +> previous lucky number < n < next lucky number + +where *n* is your input. + +If *n* is a lucky number, then display +> n is a lucky number. + +#Challenge Input + +> 103 + +> 225 + +> 997 + +#Challenge Output + +> 99 < 103 < 105 + +> 223 < 225 < 231 + +> 997 is a lucky number + +#Bonus + +Find every lucky number all the way up to ~~5000~~10,000,000 and post your the time it took to run. This is so that you can compete amongst everyone else to see who has the most efficient one. + +----- + +If you have any cool challenges, feel free to submit it to /r/dailyprogrammer_ideas! + +Edit: /u/nuri0 and /u/mattieshoes pointed out some errors. Corrected the post. + +Edit: Limit for bonus increased because it was becoming difficult to measure the time taken. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0330 Easy - Surround the circles/challenge_text.md b/Easy Challenges/Challenge 0330 Easy - Surround the circles/challenge_text.md new file mode 100644 index 0000000..9fcc341 --- /dev/null +++ b/Easy Challenges/Challenge 0330 Easy - Surround the circles/challenge_text.md @@ -0,0 +1,50 @@ +# Description + +In this challenge, you will be given a set of circles, defined by their centers and radii. Your goal is to find the bounding rectangle which will contain all of the circles completely. + +Write a program that determines the vertices of the bounding rectangle with sides parallel to the axes. + +# Input Description + +Each line will contain a comma separated center and radius for a circle. + +# Output Description + +The format of the output will be comma separated coordinates, rounded to 3 decimal places. + +# Challenge Input + + 1,1,2 + 2,2,0.5 + -1,-3,2 + 5,2,1 + +[input picture](https://i.imgur.com/uz6Bxqb.png) + +# Challenge Output + + (-3.000, -5.000), (-3.000, 3.000), (6.000, 3.000), (6.000, -5.000) + +[output picture](http://i.imgur.com/GAxlE8O.png) + +# Bonus + +For the bonus, we will rotate the axis for the bounding rectangle. The first line of input will now be a vector determining the direction of one edge of the bounding rectangle. + +# Bonus Input + + 1,1 + 1,1,2 + 2,2,0.5 + -1,-3,2 + 5,2,1 + +# Bonus Output + + (-4.828, -2.000), (2.793, 5.621), (6.621, 1.793), (-1.000, -5.828) + +[bonus output picture](http://i.imgur.com/5IMZWPp.png) + +# Credit + +This challenge was suggested by user /u/Preferencesoft, many thanks! If you have an idea for a challenge please share it on /r/dailyprogrammer_ideas and there's a good chance we'll use it. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0331 Easy - The Adding Calculator/challenge_text.md b/Easy Challenges/Challenge 0331 Easy - The Adding Calculator/challenge_text.md new file mode 100644 index 0000000..7ff847e --- /dev/null +++ b/Easy Challenges/Challenge 0331 Easy - The Adding Calculator/challenge_text.md @@ -0,0 +1,65 @@ +#**Description** + +Make a calculator that lets the user add, subtract, multiply and divide integers. It should allow exponents too. The user can only enter integers and must expect the result to be integers. The twist is that YOU, the programmer, can only let the program calculate expressions using addition. Only addition. The user can enter 3*2 however you cannot calculate it using multiplication. + +Basically, the programmer is not allowed to multiply, divide and subtract using the operations provided by a programming language. To the programmer, the only accessible *direct* operation is addition. + +Your calculator should be able to handle addition, subtraction, division, multiplication and exponents. No modulo operation (to obtain the remainder for two given operands) too. + +Please note that + ++ You are not allowed to use any functions (other than user-defined functions) to work with exponents. Basically, don't cheat by allowing pre-defined functions from a library for the dirty work. + ++ You can use logical operators. + ++ The only binary arithmetic operator that you can use is \+ (addition). + ++ The only unary operator that you can use is \+\+ (increment operator). + ++ No bitwise operations are allowed. + +#**Input description** + +Allow the user to enter two integers and the operation symbol. + +Let's use \^ for exponents i.e. 2\^3 = 2^3 = 8 + +#**Output description** + +If the answer is an integer, display the answer. If the answer is not an integer, display a warning message. Handle errors like 1/0 appropriately. + +#**Challenge Inputs and Outputs** + +Input | Output +:--| --: +12 + 25 | 37 +-30 + 100 | 70 +100 - 30 | 70 +100 - -30 | 130 +-25 - 29 | -54 +-41 - -10 | -31 +9 * 3 | 27 +9 * -4 | -36 +-4 * 8 | -32 +-12 * -9 | 108 +100 / 2 | 50 +75 / -3 | -25 +-75 / 3 | -25 +7 / 3 | Non-integral answer +0 / 0 | Not-defined +5 ^ 3 | 125 +-5 ^ 3 | -125 +-8 ^ 3 | -512 +-1 ^ 1 | -1 +1 ^ 1 | 1 +0 ^ 5 | 0 +5 ^ 0 | 1 +10 ^ -3 | Non-integral answer + +#**Bonus** + +Modify your program such that it works with decimals (except for \^ operation) with a minimum precision of 1 decimal place. + +---- + +Submit to /r/dailyprogrammer_ideas if you have any cool ideas! \ No newline at end of file diff --git a/Easy Challenges/Challenge 0333 Easy - Packet Assembler/challenge_text.md b/Easy Challenges/Challenge 0333 Easy - Packet Assembler/challenge_text.md new file mode 100644 index 0000000..767ebcc --- /dev/null +++ b/Easy Challenges/Challenge 0333 Easy - Packet Assembler/challenge_text.md @@ -0,0 +1,128 @@ +#Description + +When a message is transmitted over the internet, it is split into multiple packets, each packet is transferred individually, and the packets are reassembled into the original message by the receiver. Because the internet exists in the real world, and because the real world can be messy, packets do not always arrive in the order in which they are sent. For today's challenge, your program must collect packets from stdin, assemble them in the correct order, and print the completed messages to stdout. + +The point of reading from stdin is to simulate incoming packets. For the purposes of this challenge, assume there is a potentially unlimited number of packets. Your program should not depend on knowing how many packets there are in total. Simply sorting the input in its entirety would technically work, but defeats the purpose of this exercise. + +#Input description + +Each line of input represents a single packet. Each line will be formatted as `X Y Z some_text`, where X Y and Z are positive integer and some_text is an arbitrary string. X represents the message ID (ie which message this packet is a part of). Y represents the packet ID (ie the index of this packet in the message) (packets are zero-indexed, so the first packet in a message will have Y=0, the last packet in a message will have Y=Z-1). Z represents the total number of packets in the message. + +It is guaranteed that there will be no duplicate packets or message IDs. + +##Example input + + 6220 1 10 Because he's the hero Gotham deserves, + 6220 9 10 + 5181 5 7 in time, like tears in rain. Time to die. + 6220 3 10 So we'll hunt him. + 6220 5 10 Because he's not a hero. + 5181 6 7 + 5181 2 7 shoulder of Orion. I watched C-beams + 5181 4 7 Gate. All those moments will be lost + 6220 6 10 He's a silent guardian. + 5181 3 7 glitter in the dark near the Tannhäuser + 6220 7 10 A watchful protector. + 5181 1 7 believe. Attack ships on fire off the + 6220 0 10 We have to chase him. + 5181 0 7 I've seen things you people wouldn't + 6220 4 10 Because he can take it. + 6220 2 10 but not the one it needs right now. + 6220 8 10 A Dark Knight. + +#Output description + +Output each completed message, one line per packet. Messages should be outputted in the order in which they are completed. + +##Example output + + 5181 0 7 I've seen things you people wouldn't + 5181 1 7 believe. Attack ships on fire off the + 5181 2 7 shoulder of Orion. I watched C-beams + 5181 3 7 glitter in the dark near the Tannhäuser + 5181 4 7 Gate. All those moments will be lost + 5181 5 7 in time, like tears in rain. Time to die. + 5181 6 7 + 6220 0 10 We have to chase him. + 6220 1 10 Because he's the hero Gotham deserves, + 6220 2 10 but not the one it needs right now. + 6220 3 10 So we'll hunt him. + 6220 4 10 Because he can take it. + 6220 5 10 Because he's not a hero. + 6220 6 10 He's a silent guardian. + 6220 7 10 A watchful protector. + 6220 8 10 A Dark Knight. + 6220 9 10 + +#Challenge input + + 7469 1 7 believe. Attack ships on fire off the + 9949 6 10 He's a silent guardian. + 2997 9 19 Force is a pathway to many abilities some + 6450 2 11 is a vestige of the vox populi, now vacant, vanished. However, this valorous + 6450 10 11 + 6450 8 11 veers most verbose, so let me simply add that it's my very good honour to meet + 6450 5 11 and voracious violation of volition! The only verdict is vengeance; a vendetta + 9949 1 10 Because he's the hero Gotham deserves, + 6450 1 11 and villain by the vicissitudes of fate. This visage, no mere veneer of vanity, + 2997 13 19 he did. Unfortunately, he taught his + 9949 8 10 A Dark Knight. + 1938 4 17 by the iniquities of the selfish and the + 1938 0 17 You read the Bible, Brett? Well there's + 2997 0 19 Did you ever hear the tragedy of Darth + 2997 1 19 Plagueis the Wise? I thought not. It's not a + 1938 8 17 of darkness, for he is truly is brother's + 2997 14 19 apprentice everything he knew, then his + 6450 3 11 visitation of a bygone vexation stands vivified, and has vowed to vanquish these + 1938 12 17 who attempt to poison and destroy my + 6450 9 11 you and you may call me V. + 7469 2 7 shoulder of Orion. I watched C-beams + 2997 10 19 consider to be unnatural. He became so + 1938 1 17 this passage I got memorized, sorta fits + 2997 5 19 Force to influence the midichlorians to + 1938 6 17 in the name of charity and good will, + 7469 0 7 I've seen things you people wouldn't + 9949 4 10 Because he can take it. + 6450 7 11 vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage + 9949 0 10 We have to chase him. + 9949 7 10 A watchful protector. + 2997 3 19 legend. Darth Plagueis was a Dark Lord of the + 6450 6 11 held as a votive, not in vain, for the value and veracity of such shall one day + 2997 8 19 cared about from dying. The dark side of the + 1938 10 17 And I will strike down upon thee with + 1938 11 17 great vengeance and furious anger those + 1938 7 17 shepherds the weak through the valley + 1938 2 17 this occasion. Ezekiel 25:17? "The path + 2997 18 19 + 9949 9 10 + 1938 14 17 the Lord when I lay my vengeance upon + 1938 15 17 thee." + 1938 9 17 keeper and the finder of lost children. + 1938 13 17 brothers. And you will know my name is + 9949 2 10 but not the one it needs right now. + 2997 16 19 he could have others from death, but not + 2997 7 19 dark side that he could even keep the once he + 1938 5 17 tyranny of evil men. Blessed is he who, + 2997 17 19 himself. + 2997 6 19 create life...He had such a knowledge of the + 2997 12 19 losing his power. Which eventually, of course, + 7469 4 7 Gate. All those moments will be lost + 2997 2 19 story the Jedi would tell you. It's a Sith + 1938 16 17 + 2997 4 19 Sith so powerful and so wise, he could use the + 1938 3 17 of the righteous man is beset on all sides + 2997 11 19 powerful...The only thing he was afraid of was + 7469 6 7 + 2997 15 19 apprentice killed him in his sleep. Ironic, + 7469 5 7 in time, like tears in rain. Time to die. + 9949 3 10 So we'll hunt him. + 7469 3 7 glitter in the dark near the Tannhäuser + 6450 4 11 venal and virulent vermin vanguarding vice and vouchsafing the violently vicious + 6450 0 11 Voilà! In view, a humble vaudevillian veteran, cast vicariously as both victim + 9949 5 10 Because he's not a hero. + +#Finally + +Have a good challenge idea? + +Consider submitting it to /r/dailyprogrammer_ideas \ No newline at end of file diff --git a/Easy Challenges/Challenge 0335 Easy - Consecutive Distance Rating/challenge_text.md b/Easy Challenges/Challenge 0335 Easy - Consecutive Distance Rating/challenge_text.md new file mode 100644 index 0000000..753fc6e --- /dev/null +++ b/Easy Challenges/Challenge 0335 Easy - Consecutive Distance Rating/challenge_text.md @@ -0,0 +1,58 @@ + + +# Description + +We'll call the consecutive distance rating of an integer sequence the sum of the distances between consecutive integers. Consider the sequence `1 7 2 11 8 34 3`. `1` and `2` are consecutive integers, but their distance apart in the sequence is 2. `2` and `3` are consecutive integers, and their distance is 4. The distance between `7` and `8` is 3. The sum of these distances is 9. + +Your task is to find and display the consecutive distance rating of a number of integer sequences. + +# Input description + +You'll be given two integers `a` and `b` on the first line denoting the number of sequences that follow and the length of those sequences, respectively. You'll then be given `a` integer sequences of length `b`, one per line. The integers will always be unique and range from 1 to 100 inclusive. + +## Example input + + 6 11 + 31 63 53 56 96 62 73 25 54 55 64 + 77 39 35 38 41 42 76 73 40 31 10 + 30 63 57 87 37 31 58 83 34 76 38 + 18 62 55 92 88 57 90 10 11 96 12 + 26 8 7 25 52 17 45 64 11 35 12 + 89 57 21 55 56 81 54 100 22 62 50 + +# Output description + +Output each consecutive distance rating, one per line. + +## Example output + + 26 + 20 + 15 + 3 + 6 + 13 + +# Challenge input + + 6 20 + 76 74 45 48 13 75 16 14 79 58 78 82 46 89 81 88 27 64 21 63 + 37 35 88 57 55 29 96 11 25 42 24 81 82 58 15 2 3 41 43 36 + 54 64 52 39 36 98 32 87 95 12 40 79 41 13 53 35 48 42 33 75 + 21 87 89 26 85 59 54 2 24 25 41 46 88 60 63 23 91 62 61 6 + 94 66 18 57 58 54 93 53 19 16 55 22 51 8 67 20 17 56 21 59 + 6 19 45 46 7 70 36 2 56 47 33 75 94 50 34 35 73 72 39 5 + +# Notes / hints + +Be careful that your program doesn't double up the distances. Consider the sequence `1 2`. An incorrect algorithm might see 1 -> 2 and 2 -> 1 as two separate distances, resulting in a (wrong) consecutive distance rating of 2. Visually, you should think of distances like [this](https://i.imgur.com/MsFLgjW.png) and not like [that](https://i.imgur.com/2V6GMQg.png). + +#Bonus + +Modify your program to work with any size gap between integers. For instance, we might want to find the distance rating of integers with a gap of 2, such as `1` and `3` or `7 ` and `9` rather than consecutive integers with a gap of 1. + +# Credit + +This challenge was authored by /u/chunes, many thanks! + +Have a good challenge idea? Consider submitting it to /r/dailyprogrammer_ideas. \ No newline at end of file diff --git a/Easy Challenges/Challenge 0336 Easy - Cannibal numbers/challenge_text.md b/Easy Challenges/Challenge 0336 Easy - Cannibal numbers/challenge_text.md new file mode 100644 index 0000000..444157e --- /dev/null +++ b/Easy Challenges/Challenge 0336 Easy - Cannibal numbers/challenge_text.md @@ -0,0 +1,51 @@ +# Description + +Imagine a given set of numbers wherein some are cannibals. We define a cannibal as a larger number can eat a smaller number and **increase its value by 1**. There are no restrictions on how many numbers any given number can consume. A number which has been consumed is **no longer available**. + +Your task is to determine the number of numbers which can have a value equal to or greater than a specified value. + +#Input Description + +You'll be given two integers, _i_ and _j_, on the first line. _i_ indicates how many values you'll be given, and _j_ indicates the number of queries. + +Example: + + 7 2 + 21 9 5 8 10 1 3 + 10 15 + + +Based on the above description, 7 is number of values that you will be given. 2 is the number of queries. + +That means - +* Query 1 - How many numbers can have the value of at least 10 +* Query 2 - How many numbers can have the value of at least 15 + +#Output Description + +Your program should calculate and show the number of numbers which are equal to or greater than the desired number. For the sample input given, this will be - + + 4 2 + +##Explanation + +For Query 1 - + +The number 9 can consume the numbers 5 to raise its value to 10 + +The number 8 can consume the numbers 1 and 3 to raise its value to 10. + +So including 21 and 10, we can get **four** numbers which have a value of at least 10. + + + + +For Query 2 - + +The number 10 can consume the numbers 9,8,5,3, and 1 to raise its value to 15. + +So including 21, we can get **two** numbers which have a value of at least 15. + +# Credit + +This challenge was suggested by user /u/Lemvig42, many thanks! If you have a challenge idea, please share it in /r/dailyprogrammer_ideas and there's a good chance we'll use it \ No newline at end of file diff --git "a/Extra-Bonus Challenges/[Monthly Challenge #22 - September, 2017] Procedural Bacteria Fungus Virus \342\200\242 rproceduralgeneration/challenge_text.md" "b/Extra-Bonus Challenges/[Monthly Challenge #22 - September, 2017] Procedural Bacteria Fungus Virus \342\200\242 rproceduralgeneration/challenge_text.md" new file mode 100644 index 0000000..e69de29 diff --git a/Hard Challenges/Challenge #260 [Hard] Never Ending Snake/challenge_text.md b/Hard Challenges/Challenge 0260 Hard - Never Ending Snake/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #260 [Hard] Never Ending Snake/challenge_text.md rename to Hard Challenges/Challenge 0260 Hard - Never Ending Snake/challenge_text.md diff --git a/Hard Challenges/Challenge #261 [Hard] magic square dominoes/challenge_text.md b/Hard Challenges/Challenge 0261 Hard - magic square dominoes/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #261 [Hard] magic square dominoes/challenge_text.md rename to Hard Challenges/Challenge 0261 Hard - magic square dominoes/challenge_text.md diff --git a/Hard Challenges/Challenge #262 [Hard] 4x4 puzzle swapper/challenge_text.md b/Hard Challenges/Challenge 0262 Hard - 4x4 puzzle swapper/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #262 [Hard] 4x4 puzzle swapper/challenge_text.md rename to Hard Challenges/Challenge 0262 Hard - 4x4 puzzle swapper/challenge_text.md diff --git a/Hard Challenges/Challenge #263 [Hard] Hashiwokakero/challenge_text.md b/Hard Challenges/Challenge 0263 Hard - Hashiwokakero/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #263 [Hard] Hashiwokakero/challenge_text.md rename to Hard Challenges/Challenge 0263 Hard - Hashiwokakero/challenge_text.md diff --git a/Hard Challenges/Challenge #264 [Hard] Detecting Poetry Forms/challenge_text.md b/Hard Challenges/Challenge 0264 Hard - Detecting Poetry Forms/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #264 [Hard] Detecting Poetry Forms/challenge_text.md rename to Hard Challenges/Challenge 0264 Hard - Detecting Poetry Forms/challenge_text.md diff --git a/Hard Challenges/Challenge #265 [Hard] Permutations with repeat/challenge_text.md b/Hard Challenges/Challenge 0265 Hard - Permutations with repeat/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #265 [Hard] Permutations with repeat/challenge_text.md rename to Hard Challenges/Challenge 0265 Hard - Permutations with repeat/challenge_text.md diff --git a/Hard Challenges/Challenge #266 [Hard] Finding Friends in the Social Graph/challenge_text.md b/Hard Challenges/Challenge 0266 Hard - Finding Friends in the Social Graph/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #266 [Hard] Finding Friends in the Social Graph/challenge_text.md rename to Hard Challenges/Challenge 0266 Hard - Finding Friends in the Social Graph/challenge_text.md diff --git a/Hard Challenges/[2016-05-20] Challenge #267 [Hard] IDDQD/challenge_text.md b/Hard Challenges/Challenge 0267 Hard - IDDQD/challenge_text.md similarity index 100% rename from Hard Challenges/[2016-05-20] Challenge #267 [Hard] IDDQD/challenge_text.md rename to Hard Challenges/Challenge 0267 Hard - IDDQD/challenge_text.md diff --git a/Hard Challenges/Challenge #268 [Hard] Network and Cards Part 3, The cheaters/challenge_text.md b/Hard Challenges/Challenge 0268 Hard - Network and Cards Part 3, The cheaters/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #268 [Hard] Network and Cards Part 3, The cheaters/challenge_text.md rename to Hard Challenges/Challenge 0268 Hard - Network and Cards Part 3, The cheaters/challenge_text.md diff --git a/Hard Challenges/Challenge #270 [Hard] Alien Invasion Inversion/challenge_text.md b/Hard Challenges/Challenge 0270 Hard - Alien Invasion Inversion/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #270 [Hard] Alien Invasion Inversion/challenge_text.md rename to Hard Challenges/Challenge 0270 Hard - Alien Invasion Inversion/challenge_text.md diff --git a/Hard Challenges/Challenge #271 [Hard] Formatting J code/challenge_text.md b/Hard Challenges/Challenge 0271 Hard - Formatting J code/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #271 [Hard] Formatting J code/challenge_text.md rename to Hard Challenges/Challenge 0271 Hard - Formatting J code/challenge_text.md diff --git a/Hard Challenges/Challenge #272 [Hard] Air Pressure router valve - Part 1./challenge_text.md b/Hard Challenges/Challenge 0272 Hard - Air Pressure router valve - Part 1./challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #272 [Hard] Air Pressure router valve - Part 1./challenge_text.md rename to Hard Challenges/Challenge 0272 Hard - Air Pressure router valve - Part 1./challenge_text.md diff --git a/Hard Challenges/Challenge #272 [Hard] Air Pressure router valve - Part 1/challenge_text.md b/Hard Challenges/Challenge 0272 Hard - Air Pressure router valve - Part 1/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #272 [Hard] Air Pressure router valve - Part 1/challenge_text.md rename to Hard Challenges/Challenge 0272 Hard - Air Pressure router valve - Part 1/challenge_text.md diff --git a/Hard Challenges/Challenge #273 [Hard] Elggob - Make a Boggle Layout/challenge_text.md b/Hard Challenges/Challenge 0273 Hard - Elggob - Make a Boggle Layout/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #273 [Hard] Elggob - Make a Boggle Layout/challenge_text.md rename to Hard Challenges/Challenge 0273 Hard - Elggob - Make a Boggle Layout/challenge_text.md diff --git "a/Hard Challenges/Challenge #274 [Hard] \342\210\236 Loop solver/challenge_text.md" "b/Hard Challenges/Challenge 0274 Hard - \342\210\236 Loop solver/challenge_text.md" similarity index 100% rename from "Hard Challenges/Challenge #274 [Hard] \342\210\236 Loop solver/challenge_text.md" rename to "Hard Challenges/Challenge 0274 Hard - \342\210\236 Loop solver/challenge_text.md" diff --git "a/Hard Challenges/Challenge #276 [Hard] \342\210\236 Loop solver part 2/challenge_text.md" "b/Hard Challenges/Challenge 0276 Hard - \342\210\236 Loop solver part 2/challenge_text.md" similarity index 100% rename from "Hard Challenges/Challenge #276 [Hard] \342\210\236 Loop solver part 2/challenge_text.md" rename to "Hard Challenges/Challenge 0276 Hard - \342\210\236 Loop solver part 2/challenge_text.md" diff --git a/Hard Challenges/Challenge #277 [Hard] Trippy Julia fractals/challenge_text.md b/Hard Challenges/Challenge 0277 Hard - Trippy Julia fractals/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #277 [Hard] Trippy Julia fractals/challenge_text.md rename to Hard Challenges/Challenge 0277 Hard - Trippy Julia fractals/challenge_text.md diff --git a/Hard Challenges/Challenge #280 [Hard] Free Flow Solver/challenge_text.md b/Hard Challenges/Challenge 0280 Hard - Free Flow Solver/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #280 [Hard] Free Flow Solver/challenge_text.md rename to Hard Challenges/Challenge 0280 Hard - Free Flow Solver/challenge_text.md diff --git a/Hard Challenges/Challenge #281 [Hard] Minesweeper Solver/challenge_text.md b/Hard Challenges/Challenge 0281 Hard - Minesweeper Solver/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #281 [Hard] Minesweeper Solver/challenge_text.md rename to Hard Challenges/Challenge 0281 Hard - Minesweeper Solver/challenge_text.md diff --git a/Hard Challenges/Challenge #282 [Hard] Hidato/challenge_text.md b/Hard Challenges/Challenge 0282 Hard - Hidato/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #282 [Hard] Hidato/challenge_text.md rename to Hard Challenges/Challenge 0282 Hard - Hidato/challenge_text.md diff --git a/Hard Challenges/Challenge #283 [Hard] Guarding the Coast/challenge_text.md b/Hard Challenges/Challenge 0283 Hard - Guarding the Coast/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #283 [Hard] Guarding the Coast/challenge_text.md rename to Hard Challenges/Challenge 0283 Hard - Guarding the Coast/challenge_text.md diff --git a/Hard Challenges/Challenge #284 [Hard] Winning the Tournament/challenge_text.md b/Hard Challenges/Challenge 0284 Hard - Winning the Tournament/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #284 [Hard] Winning the Tournament/challenge_text.md rename to Hard Challenges/Challenge 0284 Hard - Winning the Tournament/challenge_text.md diff --git a/Hard Challenges/Challenge #285 [Hard] Math Proofs/challenge_text.md b/Hard Challenges/Challenge 0285 Hard - Math Proofs/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #285 [Hard] Math Proofs/challenge_text.md rename to Hard Challenges/Challenge 0285 Hard - Math Proofs/challenge_text.md diff --git a/Hard Challenges/Challenge #286 [Hard] Rush Hour Solver/challenge_text.md b/Hard Challenges/Challenge 0286 Hard - Rush Hour Solver/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #286 [Hard] Rush Hour Solver/challenge_text.md rename to Hard Challenges/Challenge 0286 Hard - Rush Hour Solver/challenge_text.md diff --git a/Hard Challenges/Challenge #287 [Hard] Word Numbers/challenge_text.md b/Hard Challenges/Challenge 0287 Hard - Word Numbers/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #287 [Hard] Word Numbers/challenge_text.md rename to Hard Challenges/Challenge 0287 Hard - Word Numbers/challenge_text.md diff --git a/Hard Challenges/Challenge #288 [Hard] Adjacent Numbers problems/challenge_text.md b/Hard Challenges/Challenge 0288 Hard - Adjacent Numbers problems/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #288 [Hard] Adjacent Numbers problems/challenge_text.md rename to Hard Challenges/Challenge 0288 Hard - Adjacent Numbers problems/challenge_text.md diff --git a/Hard Challenges/Challenge #289 [Hard] Spot it! cards generator/challenge_text.md b/Hard Challenges/Challenge 0289 Hard - Spot it! cards generator/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #289 [Hard] Spot it! cards generator/challenge_text.md rename to Hard Challenges/Challenge 0289 Hard - Spot it! cards generator/challenge_text.md diff --git a/Hard Challenges/Challenge #290 [Hard] Gophers and Robot Dogs/challenge_text.md b/Hard Challenges/Challenge 0290 Hard - Gophers and Robot Dogs/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #290 [Hard] Gophers and Robot Dogs/challenge_text.md rename to Hard Challenges/Challenge 0290 Hard - Gophers and Robot Dogs/challenge_text.md diff --git a/Hard Challenges/Challenge #291 [Hard] Spaghetti Wiring/challenge_text.md b/Hard Challenges/Challenge 0291 Hard - Spaghetti Wiring/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #291 [Hard] Spaghetti Wiring/challenge_text.md rename to Hard Challenges/Challenge 0291 Hard - Spaghetti Wiring/challenge_text.md diff --git a/Hard Challenges/Challenge #293 [Hard] Zombies 2 - Your Princess is in Another Castle!/challenge_text.md b/Hard Challenges/Challenge 0293 Hard - Zombies 2 - Your Princess is in Another Castle!/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #293 [Hard] Zombies 2 - Your Princess is in Another Castle!/challenge_text.md rename to Hard Challenges/Challenge 0293 Hard - Zombies 2 - Your Princess is in Another Castle!/challenge_text.md diff --git a/Hard Challenges/Challenge #294 [Hard] Rack management 3/challenge_text.md b/Hard Challenges/Challenge 0294 Hard - Rack management 3/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #294 [Hard] Rack management 3/challenge_text.md rename to Hard Challenges/Challenge 0294 Hard - Rack management 3/challenge_text.md diff --git a/Hard Challenges/Challenge #295 [Hard] Advanced pacman/challenge_text.md b/Hard Challenges/Challenge 0295 Hard - Advanced pacman/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #295 [Hard] Advanced pacman/challenge_text.md rename to Hard Challenges/Challenge 0295 Hard - Advanced pacman/challenge_text.md diff --git a/Hard Challenges/Challenge #296 [Hard] Flood Fill Puzzle Game/challenge_text.md b/Hard Challenges/Challenge 0296 Hard - Flood Fill Puzzle Game/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #296 [Hard] Flood Fill Puzzle Game/challenge_text.md rename to Hard Challenges/Challenge 0296 Hard - Flood Fill Puzzle Game/challenge_text.md diff --git a/Hard Challenges/Challenge #297 [Hard] Parentheses trees/challenge_text.md b/Hard Challenges/Challenge 0297 Hard - Parentheses trees/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #297 [Hard] Parentheses trees/challenge_text.md rename to Hard Challenges/Challenge 0297 Hard - Parentheses trees/challenge_text.md diff --git a/Hard Challenges/Challenge #298 [Hard] Functional Maze solving/challenge_text.md b/Hard Challenges/Challenge 0298 Hard - Functional Maze solving/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #298 [Hard] Functional Maze solving/challenge_text.md rename to Hard Challenges/Challenge 0298 Hard - Functional Maze solving/challenge_text.md diff --git a/Hard Challenges/Challenge #299 [Hard] Functional Graph solving/challenge_text.md b/Hard Challenges/Challenge 0299 Hard - Functional Graph solving/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #299 [Hard] Functional Graph solving/challenge_text.md rename to Hard Challenges/Challenge 0299 Hard - Functional Graph solving/challenge_text.md diff --git a/Hard Challenges/Challenge #300 [Hard] Let's make some noise part 3/challenge_text.md b/Hard Challenges/Challenge 0300 Hard - Let's make some noise part 3/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #300 [Hard] Let's make some noise part 3/challenge_text.md rename to Hard Challenges/Challenge 0300 Hard - Let's make some noise part 3/challenge_text.md diff --git a/Hard Challenges/Challenge #301 [Hard] Guitar Tablature/challenge_text.md b/Hard Challenges/Challenge 0301 Hard - Guitar Tablature/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #301 [Hard] Guitar Tablature/challenge_text.md rename to Hard Challenges/Challenge 0301 Hard - Guitar Tablature/challenge_text.md diff --git a/Hard Challenges/Challenge #302 [Hard] ASCII Histogram Maker Part 2 - The Proper Histogram/challenge_text.md b/Hard Challenges/Challenge 0302 Hard - ASCII Histogram Maker Part 2 - The Proper Histogram/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #302 [Hard] ASCII Histogram Maker Part 2 - The Proper Histogram/challenge_text.md rename to Hard Challenges/Challenge 0302 Hard - ASCII Histogram Maker Part 2 - The Proper Histogram/challenge_text.md diff --git a/Hard Challenges/Challenge #303 [Hard] Escaping a dangerous maze/challenge_text.md b/Hard Challenges/Challenge 0303 Hard - Escaping a dangerous maze/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #303 [Hard] Escaping a dangerous maze/challenge_text.md rename to Hard Challenges/Challenge 0303 Hard - Escaping a dangerous maze/challenge_text.md diff --git a/Hard Challenges/Challenge #304 [Hard] Generating a fractal using affine transformation/challenge_text.md b/Hard Challenges/Challenge 0304 Hard - Generating a fractal using affine transformation/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #304 [Hard] Generating a fractal using affine transformation/challenge_text.md rename to Hard Challenges/Challenge 0304 Hard - Generating a fractal using affine transformation/challenge_text.md diff --git a/Hard Challenges/Challenge #305 [Hard] Numbers for Sale/challenge_text.md b/Hard Challenges/Challenge 0305 Hard - Numbers for Sale/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #305 [Hard] Numbers for Sale/challenge_text.md rename to Hard Challenges/Challenge 0305 Hard - Numbers for Sale/challenge_text.md diff --git a/Hard Challenges/Challenge #306 [Hard] Generate Strings to Match a Regular Expression/challenge_text.md b/Hard Challenges/Challenge 0306 Hard - Generate Strings to Match a Regular Expression/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #306 [Hard] Generate Strings to Match a Regular Expression/challenge_text.md rename to Hard Challenges/Challenge 0306 Hard - Generate Strings to Match a Regular Expression/challenge_text.md diff --git a/Hard Challenges/Challenge #308 [Hard] Slider Game Puzzle/challenge_text.md b/Hard Challenges/Challenge 0308 Hard - Slider Game Puzzle/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #308 [Hard] Slider Game Puzzle/challenge_text.md rename to Hard Challenges/Challenge 0308 Hard - Slider Game Puzzle/challenge_text.md diff --git a/Hard Challenges/Challenge #309 [Hard] Patterns overlap/challenge_text.md b/Hard Challenges/Challenge 0309 Hard - Patterns overlap/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #309 [Hard] Patterns overlap/challenge_text.md rename to Hard Challenges/Challenge 0309 Hard - Patterns overlap/challenge_text.md diff --git a/Hard Challenges/Challenge #310 [Hard] The Guards and the Mansion/challenge_text.md b/Hard Challenges/Challenge 0310 Hard - The Guards and the Mansion/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #310 [Hard] The Guards and the Mansion/challenge_text.md rename to Hard Challenges/Challenge 0310 Hard - The Guards and the Mansion/challenge_text.md diff --git a/Hard Challenges/Challenge #311 [Hard] Procedural Dungeon Generation/challenge_text.md b/Hard Challenges/Challenge 0311 Hard - Procedural Dungeon Generation/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #311 [Hard] Procedural Dungeon Generation/challenge_text.md rename to Hard Challenges/Challenge 0311 Hard - Procedural Dungeon Generation/challenge_text.md diff --git a/Hard Challenges/Challenge #312 [Hard] Text Summarizer/challenge_text.md b/Hard Challenges/Challenge 0312 Hard - Text Summarizer/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #312 [Hard] Text Summarizer/challenge_text.md rename to Hard Challenges/Challenge 0312 Hard - Text Summarizer/challenge_text.md diff --git a/Hard Challenges/Challenge #313 [Hard] Embedded word list/challenge_text.md b/Hard Challenges/Challenge 0313 Hard - Embedded word list/challenge_text.md similarity index 100% rename from Hard Challenges/Challenge #313 [Hard] Embedded word list/challenge_text.md rename to Hard Challenges/Challenge 0313 Hard - Embedded word list/challenge_text.md diff --git a/Hard Challenges/Challenge 0314 Hard - Finding Point Nemo/challenge_text.md b/Hard Challenges/Challenge 0314 Hard - Finding Point Nemo/challenge_text.md new file mode 100644 index 0000000..b567f08 --- /dev/null +++ b/Hard Challenges/Challenge 0314 Hard - Finding Point Nemo/challenge_text.md @@ -0,0 +1,42 @@ +# Description + +What point on the world's oceans is furthest from any land? On Earth, it's slightly more than 1450 nautical miles from Ducie Island, Motu Nui, and Maher Island. The geographic coordinates of the real [Point Nemo](http://factinator.com/point-nemo/) are: s48:52:31.748 w123:23:33.069. The point was named after Jules Verne’s submarine Captain Nemo, a Latin name that also happens to mean “no one.” + +Your task today is given an ASCII art map, calculate the location of Point Nemo. The map will use ASCII symbols to shade land - mountains, grassland, desert, etc. The blank spaces are ocean. Find the spot in the ocean that is furthest away from any land. + +# Input Descripton + +You'll be given a two integers on a line telling you how wide (in characters) the map is at its maximum and how many lines to read. Then you'll be given the ASCII art map with the land filled in. Assume the blank space is ocean. The world wraps around, too, just like a real map. Unlike the real world, however, assume this world is a cylinder - it makes the geometry a lot easier. + +# Output Description + +Your progam should emit the location of Point Nemo as a grid coordinate in x-y (e.g. 40,25). Count the upper left corner as 0,0. Calculate the Euclidean distance and report the closest whole number position (e.g. round to the nearest x,y coordinate). + +# Challenge Input + + 80 25 + ## # # # # # # ## ### + #### ###### ######## ###### ##### ######### #### ####### + ########## ## ##### #### # ##################### + ####################### ## ### ## #### #### ## + ######### ######### ### ## # ### ## ## + # # ##### ####### ### # # + # ### ## ####### + # ### ########### # + ### ## ############## # + # ### ############## # + ## ############# + ##### ########### ## + ######### ########## ## + ############ ######### ## + ############### ####### + ############## ##### ######### + ############### ## ### ########### + ############### # ############ + ############ ### #### + ######### # + # ##### + + ######## ###### ####### + ###################### ########################### ############## + ############################################################################## diff --git a/Hard Challenges/Challenge 0316 Hard - Longest Uncrossed Knight's Path/challenge_text.md b/Hard Challenges/Challenge 0316 Hard - Longest Uncrossed Knight's Path/challenge_text.md new file mode 100644 index 0000000..44b5c84 --- /dev/null +++ b/Hard Challenges/Challenge 0316 Hard - Longest Uncrossed Knight's Path/challenge_text.md @@ -0,0 +1,38 @@ +# Description + +The longest uncrossed (or nonintersecting) knight's path is a mathematical problem involving a knight on the standard 8×8 chessboard or, more generally, on a square *n×n* board. The problem is to find the longest path the knight can take on the given board, such that the path does not intersect itself. When calculating the path length, you count the *moves* you make and not the number of squares you touch. + +A further distinction can be made between a closed path, which ends on the same field as where it begins, and an open path, which ends on a different field from where it begins. + +For this challenge, assume the following: + +* You can make an open path +* You can start (and end) on any legal square +* Just like real chess, you're bounded by legal squares on the board +* The path is constructed from line segments between the start and end points of any of the knight's moves; intermediate squares it jumps over don't matter + +This problem is intimately related to the knight's tour, a self-intersecting knight's path visiting all fields of the board. The key difference with this challenge is that the path may not intersect itself. Variants use fairy chess pieces like the camel ((3,1)-leaper), giraffe ((4,1)-leaper) and zebra ((3,2)-leaper) lead to problems of comparable complexity. + +# Input Description + +You'll be given the size *n* of the board representing the number of squares per side - it's a square board. Example: + + 5 + +# Output Description + +Your program should emit the length of the longest open tour, measured in line segments (e.g. moves). Example: + + 10 + +# Challenge Input + + 4 + 7 + 8 + +# Challenge Output + + 5 + 24 + 35 diff --git a/Hard Challenges/Challenge 0317 Hard - Poker Odds/challenge_text.md b/Hard Challenges/Challenge 0317 Hard - Poker Odds/challenge_text.md new file mode 100644 index 0000000..37dced2 --- /dev/null +++ b/Hard Challenges/Challenge 0317 Hard - Poker Odds/challenge_text.md @@ -0,0 +1,57 @@ +#DESCRIPTION + +Playing Texas Hold'em is a game about weighing odds. Every player is given two cards that only they can see. Then five cards are turned up on the table that everybody sees. The winner is the player with the best hand composed of five cards out of the seven available (the 5 on the table, and the two personal cards). + +Your job is, given four hands of two cards, and the "flop" (three of the five cards that will be flipped up), calculate the odds every player has of getting the best hand. + +#INPUT + +You will be given 5 lines, the first line contains the three cards on the flop, the next four with the two-card hands of every player. written as \[CardValue]\[CardSuit], with the values being, in order, A, 2, 3, 4, 5, 6, 7, 8, 9, 0, J, Q, K, A (Aces `A` may be high or low, just like real poker). The suits' corresponding symbols are the first letter of the suit name; Clubs = C; Spades = S; Diamonds = D; Hearts = H. + +#OUTPUT + +Four lines of text, writing... + + [PlayerNum] : [Odds of Winning (rounded to 1 decimal point)] % + +#SAMPLE INPUT + + 3D5C9C + 3C7H + AS0S + 9S2D + KCJC + +#SAMPLE OUTPUT + + 1: 15.4% + 2: 8.8% + 3: 26.2% + 4: 49.6% + +# NOTES + +For those unfamiliar, here is the order of hand win priority, from best up top to worst at the bottom; + +* Straight Flush (5 cards of consecutive value, all the same suit; ie: 3D4D5D6D7D) +* Four of a Kind (4 of your five cards are the same value; ie: AC4DAHASAD) +* Full House (Contains a three-of-a-kind and a pair; ie: AHADAS5C5H) +* Flush (All five cards are of the same suit; ie: AH4H9H3H2H) +* Straight (All five cards are of consecutive value; ie: 3D4S5H6H7C) +* Three-of-a-kind (Three cards are of identical value; ie: AS3C3D4H7S) +* Two Pairs (Contains two pairs; ie: AH3H4D4S2C) +* Pair (Contains two cards of identical value; ie: AHAC2S6D9D) +* High-Card (If none of the above, your hand is composed of "this is my highest card", ie; JHKD0S3H4D becomes "High Card King".) + +In the event that two people have the same hand value, whichever has the *highest card that qualifies of that rank.* ie; If you get a pair, the value of the pair is counted first, followed by high-card. If you have a full house, the value of the triplet is tallied first, the the pair. + * Per se; two hands of 77820 and 83J77 both have pairs, of sevens, but then Person 2 has the higher "high card" outside the ranking, a J beats a 0. + + * If the high cards are the same, you go to the second-highest card, etc. + +If there is a chance of a tie, you can print that separately, but for this challenge, only print out the chance of them *winning by themselves*. + +ALSO REMEMBER; There are 52 cards in a deck, there can't be two identical cards in play simultaneously. + +# Credit + +This challenge was suggested by /u/Mathgeek007, many thanks. If you have a suggestion for a challenge, please share it at /r/dailyprogrammer_ideas and there's a good chance we'll use it. \ No newline at end of file diff --git a/Hard Challenges/Challenge 0318 Hard - Ladder Logic/challenge_text.md b/Hard Challenges/Challenge 0318 Hard - Ladder Logic/challenge_text.md new file mode 100644 index 0000000..5a604aa --- /dev/null +++ b/Hard Challenges/Challenge 0318 Hard - Ladder Logic/challenge_text.md @@ -0,0 +1,185 @@ +#Description +Most industrial equipment is ran on Programmable Logic Controllers (PLCs). To this day, the most common programming language for these systems (in the US) is a graphical language called "Ladder Logic". +Based on traditional circuit relay systems, it is called Ladder Logic because the code resembles a ladder, with statements organized into "rungs" with "power" flowing from left to right through the logic. Any statement that evaluates to true allows power to pass, and more statements to be evaluated in an "AND" configuration. If power is blocked, power flows top-bottom, in an "OR" configuration (if so programmed). This is described below with diagrams. +This language excels at displaying boolean logic in a way that is incredibly intuitive for electricians and industrial maintenance personnel to read and troubleshoot without advanced programming knowledge or skills. Statements that evaluate to true are highlighted, so any logic with a highlighted path from left to right is true. + +As the programs are controlling real world equipment, there is a series of hardwired inputs and outputs. These are labeled sequentially with a prefix that corresponds to the (I)nput or (O)utput. For example I0 may be hooked up to a switch and O4 may be hooked up to a horn. Additionally, internal system memory can be accessed with different prefixes for different data types (B for bools, N for integers, T for timers, etc.) + +The rungs are always flanked by vertical rails - the left representing the "power" supply and the right representing the "power" return or ground. A EOR signifies the end of one rung and SOR the start of the next. The rails must travel the entire length of the program. + +There are a number of instructions used but we will focus on the most common: + + Representation Instruction Mnemonic Description + + |- SOR Start Of Rung + + -| |- XIC True if 1 (eXamine If Closed) + + -|/|- XIO True if 0 (eXamine If Open) + + -+-?-+- BST Or Start (Branch STart) + | | NXB Or Entry (NeXt Branch) + +-?-+ BND Or End (Branch eND) + + -( )- OTE Set to result of logic (OuTput Energize) + + -(L)- OTL Set to True if logic is true (OuTput Latch) + + -(U)- OTU Set to False if logic is true (OuTput Unlatch) + + -| EOR End Of Rung + +Your task is to convert a series of mnemonics and data points (inputs, outputs, memory locations) into the graphical representation. Each rung should be numbered. The number of dashes between items does not matter but it should be readable and reasonably aligned. It is common for all input logic to be aligned to the left and for all output logic to be aligned to the right side of the screen, but this is not requied. I have provided some pseudo code with each example that more or less matches what is going on in the ladder logic for reference. Instead of a text representation, feel free to do a graphical representation instead. + + +#Formal Inputs & Outputs + + +##Example 1 - Motor Starter (Traditional Ladder Style) + +I1 = stop button, I2 = Start Button, O1 = Motor. + +Start the motor when the start button is pressed. + +If the stop button is pressed, the motor needs to stop. + +###Traditional Programming Equivalent: + + If I1 AND (I2 OR O1){ + O1 = 1 + }Else{ + O1 = 0 + } + +###Input: + + SOR XIC I1 BST XIC I2 NXB XIC O1 BND OTE O1 EOR + +Output: + + | I1 I2 O1 | + 01 |--| |--+--| |--+--( )--| + | | O1 | | + | +--| |--+ | + + +##Example 2 - Motor Starter (Non-Traditional Ladder Style) + +I1 = stop button, I2 = Start Button, O1 = Motor. + +Start the motor when the start button is pressed. + +If the stop button is pressed, the motor needs to stop. + +Note that this is generally considered a bad practice in ladder logic - Typically you want to only ever change the state of an output in one instruction to avoid race conditions. This is a simple example so a race is unlikely, but for more complicated systems it is a definite possibility. + +###Traditional Programming Equivalent: + + If I1 AND I2{ + O1 = 1 + } + If NOT I2{ + O1 = 0 + } + +###Input: + + SOR XIC I1 XIO I2 OTL O1 EOR SOR XIC I2 OTU 01 EOR + +###Output: + + | I1 I2 O1 | + 01 |--| |--|/|------------------(L)--| + | | + | I2 O1 | + 02 |--| |-----------------------(U)--| + + +##Example 3 - Motor Starter With Light + +I1 = Stop button, I2 = Start Button, O1 = Motor, O2 = Light + +Start the motor when the start button is pressed. + +If the stop button is pressed, the motor needs to stop. + +A light should indicate that the motor is not running. + +Traditional Programming Equivalent: + + If I1 AND (I2 OR O1){ + O1 = 1 + }Else{ + O1 = 0 + } + If NOT O1{ + O2 = 1 + }Else{ + O2 = 0 + } + +###Input: + + SOR XIC I1 BST XIC I2 NXB XIC O1 BND OTE O1 EOR SOR XIO O1 OTE O2 EOR + +###Output: + + | I1 I2 O1 | + 01 |--| |--+--| |--+--( )--| + | | O1 | | + | +--| |--+ | + | O1 O2 | + 02 |-|/|--------------( )--| + + +##Example 4 Motor Starter With Local/Remote Select + +I1 = Stop, I2 = Local Start, I3 & I4 = Remote Start buttons, I5 = Local/Remote Toggle Switch, O1 = Motor + +If the system is in local mode, start the motor when the local start button is pressed. + +If not in local, start the motor when either remote start is pressed. + +If the stop button is pressed, the motor needs to stop. + +###Traditional Programming Equivalent: + + If I1 AND ((I2 AND I5) OR ((I3 OR I4) AND NOT I5) OR O1){ + O1 = 1 + }Else{ + O1 = 0 + } + +###Input: + + SOR XIC I1 BST XIC I2 XIC I5 NXB BST XIC I3 NXB XIC I4 BND XIO I5 NXB XIC O1 BND OTE O1 EOR + +###Output: + + | I1 I2 I5 O1 | + 01 |--| |--+--| |-------| |--+--( )--| + | | I3 I5 | | + | +--+-| |--+--|/|--+ | + | | | I4 | | | + | | +-| |--+ | | + | | O1 | | + | +--| |------------+ | + + + + +#Notes/Hints + +Here are some resources on the language itself: + +https://en.wikipedia.org/wiki/Ladder_logic + +http://library.automationdirect.com/understanding-ladder-logic/ + +The actual mnemonics and representations used for each instruction varies by PLC brand / manufacturer, but the core functionality is the same. For example, in popular German PLCs, xic becomes A (for and), xio becomes AN (for and not), branch becomes A(O ? O ?...) (for and (or or or)). The Germans don't typically use the ladder representation at all though - it's all done directly with the mnemonics. + +Modern PLCs support many more languages than ladder (https://en.wikipedia.org/wiki/IEC_61131-3) and many now have some basic memory management allowing memory and IO addresses to be referenced by name rather than address. + +# Credit + +This challenge was suggested by user /u/unitconversion, many thanks. If you have a challenge idea, please share it on /r/dailyprogrammer_ideas and there's a good chance we'll use it. diff --git a/Hard Challenges/Challenge 0319 Hard - Worm Wars 2 - Network Epidemiology/challenge_text.md b/Hard Challenges/Challenge 0319 Hard - Worm Wars 2 - Network Epidemiology/challenge_text.md new file mode 100644 index 0000000..d0d7314 --- /dev/null +++ b/Hard Challenges/Challenge 0319 Hard - Worm Wars 2 - Network Epidemiology/challenge_text.md @@ -0,0 +1,90 @@ +# Description + +This one builds on the previous challenge: malware propagation. But now we add a twist - network topology, specifically connectivity and congestion. + +Real world network malware can't attack a host it can't connect to. That connection may be blocked due to a lack of connectivity between the host (e.g. not directly connected networks), or a congested pipe. Network connections get congested when they're flooded with traffic, forcing packet loss. + +For today's challenge, you're being asked to model a small network in which some malware has been introduced. Unlike the previous challenge, you have to traverse the network to reach all nodes. This more realistically mimics propagation where contact is required to propagate. Work with these assumptions: + +- To spread the malware has to send a single packet of size B and takes 1 time step +- The network has fixed capacity between subnets +- The only thing passing over the network is malware propagation traffic, there is no background utilization +- If you try and send a packet over a pipe at 95% utilization or above it gets dropped +- Propagation between two hosts can only occur if they can directly connect from network to network or are in the same network +- To determine _where_ to send the next packet of infection, take the sum of all reachable nodes and pick a random number in that range; if that's local or remote (and which subnet) then determines where the packet is headed +- Patches (to move a node to the R state) doesn't require direct connectivity, assume an out-of-band mechanism +- An infected host can only send one packet at a time +- Assume the standard SIR model from last time + +# Challenge Input + +You'll be given a lot of information for this one. First an integer on one line telling you how many networks to read. For each network specification you'll have a line telling you the network ID (a letter), the number of hosts in it (N), the number of infected hosts at time 0 (I). Then another integer telling you how many links to read. Then that many lines telling you what two networks connect and with what capacity in bytes per second (assume symmetric connections). Finally for the malware you'll be given some values on a line telling you the transition rates for S to I, I to R and S to R. Finally a line with a single integer, B, telling you the size of the malware propagation packet (assume UDP, so a single packet to infect). Example: + + 10 + A 1000 1 + B 1000 0 + C 1000 3 + D 1000 0 + E 1000 0 + F 1000 1 + G 1000 10 + H 1000 0 + I 1000 0 + J 1000 90 + 10 + A B 10000 + B C 1000 + C D 2000 + D E 2000 + D F 2000 + D G 5000 + D H 9000 + D I 1000 + D A 8000 + D J 10000 + 0.01 0.01 0.015 + 256 + +# Challenge Input 2 + + 15 + A 4412 0 + B 12035 5 + C 11537 9 + D 10873 15 + E 7269 12 + F 10989 19 + G 9680 3 + H 8016 14 + I 5373 10 + H 10738 18 + J 1329 9 + K 12168 0 + L 9436 2 + M 1769 0 + N 7564 8 + 14 + A B 1000 + B C 1000 + C D 1000 + D E 1000 + E F 1000 + F J 1000 + F G 1000 + G K 1000 + G H 1000 + H I 1000 + H L 1000 + I E 1000 + I M 1000 + I N 1000 + 0.01 0.01 0.015 + 256 + +# Output Description + +Your program can emit answers in a number of different ways: + +- Graphical - show S I and R populations over time (as total or fractions) +- Textual - a huuuuge list of numbers +- Other - be creative diff --git a/Hard Challenges/Challenge 0320 Hard - Path to Philosophy/challenge_text.md b/Hard Challenges/Challenge 0320 Hard - Path to Philosophy/challenge_text.md new file mode 100644 index 0000000..70c004c --- /dev/null +++ b/Hard Challenges/Challenge 0320 Hard - Path to Philosophy/challenge_text.md @@ -0,0 +1,77 @@ +#Description + +Clicking on the first link in the main text of a Wikipedia article not in parentheses, and then repeating the process for subsequent articles, usually eventually gets you to the Philosophy article. As of May 26, 2011, 94.52% of all articles in Wikipedia lead eventually to the article Philosophy. The rest lead to an article with no wikilinks or with links to pages that do not exist, or get stuck in loops. +[Here's a youtube video demonstrating this phenomenon.](http://www.youtube.com/watch?v=vehDe2lSptU) + +Your goal is to write a program that will find the path from a given article to the Philosophy article by following the first link (not in parentheses) in the main text of the given article. + +#Formal Inputs & Outputs + +##Input description + +The program should take in a string containing a valid title of a Wikipedia article. + +##Output description + +Your program must print out each article in the path from the given article to [Philosophy](http://en.wikipedia.org/wiki/Philosophy). + +##Sample Inputs & Outputs + +**Input** + + Molecule + +**Output** + + Molecule + Atom + Matter + Invariant mass + Energy + Kinetic energy + Physics + Natural philosophy + Philosophy + + +## Challenge Input + + Telephone +**Solution to challenge input** + + Telephone + Telecommunication + Transmission (telecommunications) + Analog signal + Continuous function + Mathematics + Quantity + Property (philosophy) + Logic + Reason + Consciousness + Subjectivity + Subject (philosophy) + Philosophy + +#Notes/Hints + +To start you can go to the url `http://en.wikipedia.org/wiki/{subject}`. + +The title of the page that you are on can be found in the element `firstHeading` and the content of the page can be found in `bodyContent`. + +#Bonus 1 + +Cycle detection: Detect when you visit an already visited page. + +#Bonus 2 + +Shortest path detection: Visit, preferably in parallel, all the links in the content to find the shortest path to Philosophy + +#Finally + +Have a good challenge idea, like /u/nagasgura did? + +Consider submitting it to /r/dailyprogrammer_ideas. + +Oh and please don't go trolling and changing the wiki pages just for this challenge \ No newline at end of file diff --git a/Hard Challenges/Challenge 0321 Hard - Circle Splitter/challenge_text.md b/Hard Challenges/Challenge 0321 Hard - Circle Splitter/challenge_text.md new file mode 100644 index 0000000..cd15c4d --- /dev/null +++ b/Hard Challenges/Challenge 0321 Hard - Circle Splitter/challenge_text.md @@ -0,0 +1,70 @@ +# [](#HardIcon) _(Hard)_: Circle Splitter + +*(sorry for submitting this so late! currently away from home and apparently the internet hasn't arrived in a lot of places in Wales yet.)* + +Imagine you've got a square in 2D space, with axis values between 0 and 1, like [this diagram](http://i.imgur.com/5K0HZEk.png). The challenge today is conceptually simple: can you place a circle within the square such that exactly half of the points in the square lie within the circle and half lie outside the circle, like [here](http://i.imgur.com/n7BDeyg.png)? You're going to write a program which does this - but you also need to find the *smallest* circle which solves the challenge, ie. has the minimum area of any circle containing exactly half the points in the square. + +This is a hard challenge so we have a few constraints: + +* Your circle must lie entirely within the square (the circle may touch the edge of the square, but no point within the circle may lie outside of the square). +* Points on the edge of the circle count as being inside it. +* There will always be an even number of points. + +There are some inputs which cannot be solved. If there is no solution to this challenge then your solver must indicate this - for example, in [this scenaro](http://i.imgur.com/fDGPvX3.png), there's no "dividing sphere" which lies entirely within the square. + +# Input & Output Description + +## Input + +On the first line, enter a number **N**. Then enter **N** further lines of the format `x y` which is the (x, y) coordinate of one point in the square. Both x and y should be between 0 and 1 inclusive. This describes a set of **N** points within the square. The coordinate space is **R**^2 (ie. x and y need not be whole numbers). + +As mentioned previously, **N** should be an even number of points. + +## Output + +Output the centre of the circle (x, y) and the radius r, in the format: + + x y + r + +If there's no solution, just output: + + No solution + +# Challenge Data + +There's a number of valid solutions for these challenges so I've written an input generator and visualiser in lieu of a comprehensive solution list, which can be found [here](https://jsfiddle.net/gjkdc8hL/). This can visualuse inputs and outputs, and also generate inputs. It can tell you whether a solution contains exactly half of the points or not, but it can't tell you whether it's the smallest possible solution - that's up to you guys to work out between yourselves. ;) + +## Input 1 + + 4 + 0.4 0.5 + 0.6 0.5 + 0.5 0.3 + 0.5 0.7 + +## Potential Output + + 0.5 0.5 + 0.1 + +## Input 2 + + 4 + 0.1 0.1 + 0.1 0.9 + 0.9 0.1 + 0.9 0.9 + +*This has no valid solutions.* + +Due to the nature of the challenge, and the mod team being very busy right now, we can't handcraft challenge inputs for you - but do make use of the generator and visualiser provided above to validate your own solution. And, as always, validate each other's solutions in the DailyProgrammer community. + +# Bonus + +* Extend your solution to work in higher dimensions! +* Add visualisation into your own solution. If you do the first bonus point, you might want to consider using OpenGL or something similar for visualisations, unless you're a mad lad/lass and want to write your own 3D renderer for the challenge. + +# We need more moderators! + +We're all pretty busy with real life right now and could do with some assistance writing quality challenges. Check out [jnazario's post](https://www.reddit.com/r/dailyprogrammer/comments/6fm3yy/announce_seeking_moderators/) for more information if you're interested in joining the team. \ No newline at end of file diff --git a/Hard Challenges/Challenge 0322 Hard - Static HTTP Server/challenge_text.md b/Hard Challenges/Challenge 0322 Hard - Static HTTP Server/challenge_text.md new file mode 100644 index 0000000..3870f21 --- /dev/null +++ b/Hard Challenges/Challenge 0322 Hard - Static HTTP Server/challenge_text.md @@ -0,0 +1,40 @@ +# Description + +I'm willing to bet most of you are familiar with HTTP, you're using it right now to read this content. If you've ever done any web programming you probably interacted with someone else's HTTP server stack - Flask, Apache, Nginx, Rack, etc. + +For today's challenge, the task is to implement your own HTTP server. No borrowing your language's built in server (e.g. no, you can't just use Python's SimpleHTTPServer). The rules, requirements, and constraints: + +- Your program will implement the bare basics of HTTP 1.0: GET requests required, any other methods (POST, HEAD, etc) are optional (see the bonus below). +- You have to write your own network listening code (e.g. `socket()`) and handle listening on a TCP port. Most languages support this, you have to start this low. Yep, learn some socket programming. `socket() ... bind() ... listen() ... accept() ...` and the like. +- Your server should handle static content only (e.g. static HTML pages or images), no need to support dynamic pages or even cgi-bin executables. +- Your server should support a document root which contains pages (and paths) served by the web server. +- Your server should correctly serve content it finds and can read, and yield the appropriate errors when it can't: 500 for a server error, 404 for a resource not found, and 403 for permission denied (e.g. exists but it can't read it). +- For it to display properly in a browser, you'll need to set the correct content type header in the response. +- You'll have to test this in a browser and verify it works as expected: content displays right (e.g. HTML as HTML, text as text, images as images), errors get handled properly, etc. + +A basic, bare bones [HTTP/1.0 request](https://www.w3.org/Protocols/HTTP/1.0/spec.html#Request) looks like this; + + GET /index.html HTTP/1.0 + +That's it, no Host header required etc., and all other headers like user-agent and such are optional. (HTTP/1.1 requires a host header, in contrast.) + +A basic, bare bones [HTTP/1.0 response](https://www.w3.org/Protocols/HTTP/1.0/spec.html#Response) looks like this: + + HTTP/1.0 200 OK + Content-type: text/html + +
| Food | +Price (10 lbs) | + + + + <% data["foods"].each do |k,v| %> +
|---|---|
| <%= k %> | +<%= v %> | +