/DailyProgrammer

/r/DailyProgrammer Challenges

Primary LanguageJavaThe UnlicenseUnlicense

DailyProgrammer

DailyProgrammer Subreddit | List of Challenges

Challenge #1

create a program that will ask the users name, age, and reddit username. have it tell them the information back, in the format: your name is (blank), you are (blank) years old, and your username is (blank) for extra credit, have the program log this information in a file to be accessed later.

create a program that will allow you to enter events organizable by hour. There must be menu options of some form, and you must be able to easily edit, add, and delete events without directly changing the source code. (note that by menu i dont necessarily mean gui. as long as you can easily access the different options and receive prompts and instructions telling you how to use the program, it will probably be fine)

we all know the classic "guessing game" with higher or lower prompts. lets do a role reversal; you create a program that will guess numbers between 1-100, and respond appropriately based on whether users say that the number is too high or too low. Try to make a program that can guess your number based on user input and great code!


Challenge #2

Hello, coders! An important part of programming is being able to apply your programs, so your challenge for today is to create a calculator application that has use in your life. It might be an interest calculator, or it might be something that you can use in the classroom. For example, if you were in physics class, you might want to make a F = M * A calc. EXTRA CREDIT: make the calculator have multiple functions! Not only should it be able to calculate F = M * A, but also A = F/M, and M = F/A!

create a short text adventure that will call the user by their name. The text adventure should use standard text adventure commands ("l, n, s, e, i, etc."). for extra credit, make sure the program doesn't fault, quit, glitch, fail, or loop no matter what is put in, even empty text or spaces. These will be tested rigorously! For super extra credit, code it in C

Your mission is to create a stopwatch program. this program should have start, stop, and lap options, and it should write out to a file to be viewed later.


Challenge #3

Welcome to cipher day! write a program that can encrypt texts with an alphabetical caesar cipher. This cipher can ignore numbers, symbols, and whitespace. for extra credit, add a "decrypt" function to your program!

Welcome to cipher day! Create a program that can take a piece of text and encrypt it with an alphabetical substitution cipher. This can ignore white space, numbers, and symbols. for extra credit, make it encrypt whitespace, numbers, and symbols! for extra extra credit, decode someone elses cipher!

Welcome to cipher day! For this challenge, you need to write a program that will take the scrambled words from this post, and compare them against THIS WORD LIST to unscramble them. For bonus points, sort the words by length when you are finished. Post your programs and/or subroutines! Here are your words to de-scramble: mkeart sleewa edcudls iragoge usrlsle nalraoci nsdeuto amrhat inknsy iferkna


Challenge #4

You're challenge for today is to create a random password generator! For extra credit, allow the user to specify the amount of passwords to generate. For even more extra credit, allow the user to specify the length of the strings he wants to generate!

create a calculator program that will take an input, following normal calculator input (5*5+4) and give an answer (29). This calculator should use all four operators. For extra credit, add other operators (6(4+3), 3 ** 3, etc.)

today, your challenge is to create a program that will take a series of numbers (5, 3, 15), and find how those numbers can add, subtract, multiply, or divide in various ways to relate to eachother. This string of numbers should result in 5 * 3 = 15, or 15 /3 = 5, or 15/5 = 3. When you are done, test your numbers with the following strings: 4, 2, 8 6, 2, 12 6, 2, 3 9, 12, 108 4, 16, 64 For extra credit, have the program list all possible combinations. for even more extra credit, allow the program to deal with strings of greater than three numbers. For example, an input of (3, 5, 5, 3) would be 3 * 5 = 15, 15/5 = 3. When you are finished, test them with the following strings. 2, 4, 6, 3 1, 1, 2, 3 4, 4, 3, 4 8, 4, 3, 6 9, 3, 1, 7


Challenge #5

Your challenge for today is to create a program which is password protected, and wont open unless the correct user and password is given. For extra credit, have the user and password in a seperate .txt file. for even more extra credit, break into your own program :)

Your challenge today is to write a program that can find the amount of anagrams within a .txt file. For example, "snap" would be an anagram of "pans", and "skate" would be an anagram of "stake".

Arrr, me mateys! Yer' challenge fer' today be a tough one. It be gettin awfully borein' on the high seas, so yer' job be to create a pirate based fightin' game! This game oughter' be turn based, and you oughter' be able to pick yer attacks every turn. The best game'll be winnin' some custom flair, and all the rest o' ya will be walkin the plank!


Challenge #6

You're challenge for today is to create a program that can calculate pi accurately to at least 30 decimal places. Try not to cheat :)

create a program that can remove all duplicate strings from a .txt. file. for example, "bdbdb" -> "bd" we are really sorry about this :( .. I just woke up now and am looking at this disaster. We promise to give a bonus question soon ... for those who still have time, here is the modified question: remove duplicate substrings. Ex: aaajtestBlaBlatestBlaBla ---> aaajtestBlaBla another example: aaatestBlaBlatestBlaBla aaathisBlaBlathisBlaBla aaathatBlaBlathatBlaBla aaagoodBlaBlagoodBlaBla aaagood1BlaBla123good1BlaBla123 output desired: aaatestBlaBla aaathisBlaBla aaathatBlaBla aaagoodBlaBla aaagood1BlaBla123 I am really sorry for the vagueness. Hopefully will not be repeated again :(

create a AI that will play NIM https://en.wikipedia.org/wiki/Nim


Challenge #7

Write a program that can translate Morse code in the format of ...---... A space and a slash will be placed between words. ..- / --.- For bonus, add the capability of going from a string to Morse code. Super-bonus if your program can flash or beep the Morse. This is your Morse to translate: .... . .-.. .-.. --- / -.. .- .. .-.. -.-- / .--. .-. --- --. .-. .- -- -- . .-. / --. --- --- -.. / .-.. ..- -.-. -.- / --- -. / - .... . / -.-. .... .- .-.. .-.. . -. --. . ... / - --- -.. .- -.--

Write a program that draws a recursive image. For example, a Sierpinski triangle , a Barnsley fern , or a Mandelbrot set fractal would be good drawings. Any recursive image will do, but try to make them look fun or interesting. Bonus points for adding a color scheme! Please post a link to a sample image produced by your program, and above all, be creative.

This challenge will focus on creating a bot that can log into Reddit! Write a program that can log into a working Reddit account. Since this challenge is vague, bonus points are awarded for a few different things: If the bot can navigate the site and view posts If the bot can make posts If the bot can make statistics from the front page/any subreddit. These statistics include time on front page, number of comments, upvotes, downvotes, etc. The more functionality in your bot, the better.


Challenge #8

write a program that will print the song "99 bottles of beer on the wall". for extra credit, do not allow the program to print each loop on a new line.

Write a program that will print the english name of a value. for example, "1211" would become "one-thousand, two hundred, eleven". for extra credit, allow it to read the english value of a number and output the integer. input: one-hundred, four output: 104

Write a program that will take coordinates, and tell you the corresponding number in pascals triangle. For example: Input: 1, 1 output:1 input: 4, 2 output: 3 input: 1, 19 output: error/nonexistent/whatever the format should be "line number, integer number" for extra credit, add a function to simply print the triangle, for the extra credit to count, it must print at least 15 lines.


Challenge #9

write a program that will allow the user to input digits, and arrange them in numerical order. for extra credit, have it also arrange strings in alphabetical order

Write a program that will take a string ("I LIEK CHOCOLATE MILK"), and allow the user to scan a text file for strings that match. after this, allow them to replaces all instances of the string with another ("I quite enjoy chocolate milk. hrmmm. yes.")

The U.S government has commissioned you to catch the terrorists! There is a mathematical pyramid with the following pattern: 1 11 21 1211 111221 312211 you must write a program to calculate up to the 40th line of this pyramid. If you don't, the terrorists win!


Challenge #10

The exercise today asks you to validate a telephone number, as if written on an input form. Telephone numbers can be written as ten digits, or with dashes, spaces, or dots between the three segments, or with the area code parenthesized; both the area code and any white space between segments are optional. Thus, all of the following are valid telephone numbers: 1234567890, 123-456-7890, 123.456.7890, (123)456-7890, (123) 456-7890 (note the white space following the area code), and 456-7890. The following are not valid telephone numbers: 123-45-6789, 123:4567890, and 123/456-7890. source: programmingpraxis.com

On December 7, 2011, Neil deGrasse Tyson tweeted: Need a distraction today? Not only does 12+1=11+2, but the letters “twelve plus one” rearrange to give you “eleven plus two” Your task is to write a program that finds equations similar to Tyson’s that form anagrams both in their symbols and in their letters. source: programmingpraxis.com

Your task is to implement the interactive game of hangman bonus point for making the game unique. be more creative!


Challenge #11

The program should take three arguments. The first will be a day, the second will be month, and the third will be year. Then, your program should compute the day of the week that date will fall on.

An “upside up” number is a number that reads the same when it is rotated 180°. For instance, 689 and 1961 are upside up numbers. Your task is to find the next upside up number greater than 1961, and to count the number of upside up numbers less than ten thousand. edit: since there is a confusion about 2 and 5, please consider them as "upside up" numbers for this problem. If you have already done without it, its ok. Sorry for the late reply. source: programmingpraxis.com

Create a program which prints out a table with the month's calendar in it, when the month and year is given as input. Extra points for highlighting the current day and providing links to next and previous months. Happy coding :)


Challenge #12

Write a small program that can take a string: "hi!" and print all the possible permutations of the string: "hi!" "ih!" "!hi" "h!i" "i!h" etc... thanks to hewts for this challenge!

Create a program that will factor a number. for example: 12 = 2 * 2 * 3 14 = 7 * 2 20 = 2 * 2 * 5 thanks to bears_in_bowlers for todays challenge!

Write a program which will take string inputs "A", "B", "C", "D", "E", "F", and "G", and make the corresponding notes, in any method of your choosing. Thanks to electric_machinery for this challenge!


Challenge #13

Find the number of the year for the given date. For example, january 1st would be 1, and december 31st is 365. for extra credit, allow it to calculate leap years, as well.

Create a program that will take any string and write it out to a text file, reversed. input: "hello!" output: "!olleh"

Create a rock-paper-scissors program, however, there should be no user input. the computer should play against itself. Make the program keep score, and for extra credit, give the option to "weigh" the chances, so one AI will one more often.


Challenge #14

Input: list of elements and a block size k or some other variable of your choice Output: return the list of elements with every block of k elements reversed, starting from the beginning of the list. For instance, given the list 12, 24, 32, 44, 55, 66 and the block size 2, the result is 24, 12, 44, 32, 66, 55.

Your task is to implement the sieve of Sundaram and calculate the list of primes to 10000. this is also an interesting article about it.

Write a program that will generate a random array/collection of 1 million integers, then sort them using a multi-threaded algorithm. Your program should take the number of threads through standard input. Bonus points if you can find the most efficient number of threads for your program.


Challenge #15

Write a program to left or right justify a text file

A 30x30 grid of squares contains 900 fleas, initially one flea per square. When a bell is rung, each flea jumps to an adjacent square at random (usually 4 possibilities, except for fleas on the edge of the grid or at the corners). What is the expected number of unoccupied squares after 50 rings of the bell? Give your answer rounded to six decimal places. source: project euler

Write a pair of programs that communicate with one another through socket connections. AKA a client-server connection. Your server should be an echo server that simply echoes any information it receives back to the client. For bonus points, your server should take a special command that will echo the subsequent information in reverse.


Challenge #16

Hi folks! We are in the midst of discussing how this subreddit will go about but for now how about we just concentrate on challenges! Write a function that takes two strings and removes from the first string any character that appears in the second string. For instance, if the first string is “Daily Programmer” and the second string is “aeiou ” the result is “DlyPrgrmmr”. note: the second string has [space] so the space between "Daily Programmer" is removed edit: if anyone has any suggestions for the subreddit, kindly post it in the feedback thread posted a day before. It will be easier to assess. Thank you.

Your task is to write a program that simulates a game of craps. Use the program to calculate various features of the game: for example, What is the most common roll or average rolls in a game or maximum roll? What is the average winning percentage? Or you can make your own questions. edit: if anyone has any suggestions for the subreddit, kindly post it in the feedback thread posted a day before. It will be easier to assess. Thank you.

You all know about O'Neill's algorithm write a program such that you compute primes for a given input by the user using it. edit: if anyone has any suggestions for the subreddit, kindly post it in the feedback thread posted a day before. It will be easier to assess. Thank you.


Challenge #17

write an application which will print a triangle of stars of user-specified height, with each line having twice as many stars as the last. sample output: @ @@ @@@@ hint: in many languages, the "+" sign concatenates strings. bonus features: print the triangle in reverse, print the triangle right justified

build an application that will search a web page for instances of sentences in quotations: "like this".

build a tic tac toe game with opponent AI bonus points for cooler AI implementations (depth/breadth first search, neural network, etc)


Challenge #18

Often times in commercials, phone numbers contain letters so that they're easy to remember (e.g. 1-800-VERIZON). Write a program that will convert a phone number that contains letters into a phone number with only numbers and the appropriate dash. Click here to learn more about the telephone keypad. Example Execution: Input: 1-800-COMCAST Output: 1-800-266-2278

Screen scraping involves interacting with the terminal display of a currently running program. There are commercial screen scraping applications available for mainframe programs that provide a web interface on top of a dumb terminal program. Write a program that will read the following from a text file to simulate the dumb terminal program. Each line represents a prompt to the user (always ends with a colon). Input constraints may be available for prompts. If they are, then they will always be surrounded in parentheses. The accepted input values will always be separated by a comma, and the value that is actually counted will be surrounded in square brackets. Once you've parsed the text file, convert the data into an HTML form output file. If the prompt did not have any input constraints, then the input type is just a text. If the prompt contained input constraints and there are less than 5 options, then the input type are radio buttons. If there are 5 or more possible input values, then the input type is a dropdown. Example: Input File Name: Gender ([M]ale, [F]emale): Position ([C]ashier, [D]eli Clerk, [M]anager, [P]roduce Clerk, [S]tock Person): Output File (HTML)

Name:
Gender: Male Female
Position: Cashier Deli Clerk Manager Produce Clerk Stock Person

Write a program that draws a square spiral. You can print out this spiral in ASCII text, but using a graphics library would produce a more pleasant output. Bonus: Now draw a normal spiral. Some samples of spirals can be found here.


Challenge #19

Challenge #19 will use The Adventures of Sherlock Holmes from Project Gutenberg. Write a program that counts the number of alphanumeric characters there are in The Adventures of Sherlock Holmes. Exclude the Project Gutenberg header and footer, book title, story titles, and chapters. Post your code and the alphanumeric character count.

Challenge #19 will use The Adventures of Sherlock Holmes from Project Gutenberg. The Adventures of Sherlock Holmes is composed of 12 stories. Write a program that counts the number of words in each story. Then, print out the story titles ordered by its word count in descending order followed by how many words each story contains. Exclude the Project Gutenberg header and footer, book title, story titles, and chapters.

Challenge #19 will use The Adventures of Sherlock Holmes from Project Gutenberg. Write a program that will build and output a word index for The Adventures of Sherlock Holmes. Assume one page contains 40 lines of text as formatted from Project Gutenberg's site. There are common words like "the", "a", "it" that will probably appear on almost every page, so do not display words that occur more than 100 times. Example Output: the word "abhorrent" appears once on page 1, and the word "medical" appears on multiple pages, so the output for this word would look like: abhorrent: 1 medical: 34, 97, 98, 130, 160 Exclude the Project Gutenberg header and footer, book title, story titles, and chapters.


Challenge #20

create a program that will find all prime numbers below 2000

create a program that will take user input and tell them their age in months, days, hours, and minutes sample output: how old are you? 18 months : 216, days : 6480, hours : 155520, and minutes : 388800

create a program that will remind you to stop procrastinating every two hours with a pop up message! :) This program has the potential of helping many people :D


Challenge #21

Input: a number Output: the next higher number that uses the same set of digits.

This idea is to implement the haar wavelet transform on an array of length 2^n. This algorithm is a critical algorithm for many image compression and image processing applications, and it is relatively simple both recursively and iteratively. The solution should take in as input an array of floating-point values, and return an array of floating point values that in some sense implements the haar wavelet transform. [See Challenge Thread For Full Description]

We'd like to write a list of people, ordered so that no one appears in the list before anyone he or she is less smart than. The input will be a list of pairs of names, one pair per line, where the first element in a pair names a person smarter than the person named by the second element of the pair. That is, each input line looks like: smarter-person : less-smart-person [See Challenge Thread For Full Description]


Challenge #22

Write a program that will compare two lists, and append any elements in the second list that doesn't exist in the first. input: ["a","b","c",1,4,], ["a", "x", 34, "4"] output: ["a", "b", "c",1,4,"x",34, "4"]

One of my favorite projects for beginners is to make a 2D (top down) maze style game using text to represent the map and the player. Print out a 20x20 (or whatever size floats your boat) grid of characters where '#' characters represent impassible walls, and spaces or '.' characters represent empty passable spaces. Draw the player in place of one of the passable characters as a + sign, or some other distinct character. Every time the player presses an arrow key, check and see if the adjacent grid square is a passable square. If so, update the player's position and reprint the 20x20 map with the + sign in the new position. [See Challenge Thread For Full Description]

For todays challenge, write a maze generator. For extra credit, write a second program which can solve the maze. [See Challenge Thread For Full Description]


Challenge #23

Input: a list Output: Return the two halves as different lists. If the input list has an odd number, the middle item can go to any of the list. Your task is to write the function that splits a list in two halves.

At McDonalds’ Restaurants, the Chicken McNugget meals are available in sizes of 6 McNuggets, 9 McNuggets, or 20 McNuggets. A number is a McNugget number if it can be the sum of the number of McNuggets purchased in an order (before eating any of them). Henri Picciotto devised the math of McNugget numbers in the 1980s while dining with his son at McDonald’s, working the problem out on a napkin. Your task is to determine all numbers that are not McNugget numbers.

Sort a given set of strings based on a unique collating sequence for each position in a string. Given N collating sequences, to sort strings of length greater than N, sequence i mod N is used at character position i. [See Challenge Thread For Full Description]


Challenge #24

Happy (Be-Lated) Pi Day! To celebrate, write a program that calculates a list of rational approximations of Pi. Output should look like: 3/1, 22/7, 333/106, 355/113, 52163/16604, 103993/33102, ...


Challenge #25

In an election, the person with the majority of the votes is the winner. Sometimes due to similar number of votes, there are no winners. Your challenge is to write a program that determines the winner of a vote, or shows that there are no winners due to a lack of majority.

Write a program to do the following: input: a base ten (non-fractional) number at the command line output: the binary representation of that number.

Write a program that places N queens on an NxN chessboard such that no two queens are on the same row, column, or diagonal, and no queen is on either of the two major diagonals (corner to corner). Get a solution for as large a value of N as you can. [See Challenge Thread For Full Description]


Challenge #26

You have a string "ddaaiillyypprrooggrraammeerr". We want to remove all the consecutive duplicates and put them in a separate string, which yields two separate instances of the string "dailyprogramer". [See Challenge Thread For Full Description]

An employer wants you to store some information about his employees in an easy to read list form. He wants you to input the names, ages, and the pay of his employees. Unfortunately, he is terrible with computers, and he'll call you in every time he wants to change something he's going to call you in, unless you add an easy way to edit the information. [See Challenge Thread For Full Description]

Create a piece of code that downloads an entire album from imgur. It should support multiple arguments. [See Challenge Thread For Full Description]


Challenge #27

Write a program that accepts a year as input and outputs the century the year belongs in (e.g.18th century's year ranges are 1701 to 1800) and whether or not the year is a leap year. [See Challenge Thread For Full Description]

Happy St.Patrick's Day! Write a program that accepts a year as input and outputs what day St. Patrick's Day falls on. Bonus: Print out the number of times St. Patrick's Day falls on a Saturday for this century. [See Challenge Thread For Full Description]

Write a program that will perform date/time addition. Input can be interactive using standard input or command line. 3 parameters are required: a whole number, a unit of time using the following values: year, month, week, day, hour, minute, second, and a date and time (you choose the date format). The result will be the new date and time. [See Challenge Thread For Full Description]


Challenge #28

The array duplicates problem is when one integer is in an array for more than once. If you are given an array with integers between 1 and 1,000,000 or in some other interval and one integer is in the array twice. How can you determine which one? [See Challenge Thread For Full Description]

A tetrahedral number is a figurate number that represents a pyramid with a triangular base and three sides. Write a program to find the base of the tetrahedron that contains an input number of balls. [See Challenge Thread For Full Description]

The idea is simple. Use the pastebin API (wrappers should not be allowed) in the most creative way to create a cool command line tool. A simple example that's very easy to implement in most modern programming languages is a program that posts to pastebin the contents of a given file. [See Challenge Thread For Full Description]