r/programmingchallenges • u/okmkz • Apr 11 '11
r/programmingchallenges • u/aveganzombie • Sep 09 '11
Make a perfect maze.
A perfect maze is one that has one and only one path between any two points in it (without backtracking).
There are quite a few algorithms out there for this, but trying to make your own is good fun.
r/programmingchallenges • u/cruise02 • Sep 09 '11
List of Programming and Logic Puzzle Sites
billthelizard.comr/programmingchallenges • u/okmkz • May 19 '11
Challenge: Reverse a string in place
This simple challenge is a frequent interview question. Write a program that reverses a string in place. "In place" means no declaring a second string or other buffer-- you get only one string variable to work with.
Input:
"Test string."Output:
".gnirts tseT"edit: obviously, this is only feasible in a language with mutable strings.
r/programmingchallenges • u/s-mores • Apr 23 '13
Huge randoms in Magic: the Gathering.
Hi guys, mod from /r/MagicTCG here. We have a weekly thread for rules questions and stuff like that and we ran into an interesting problem involving huge random numbers. Link to post in question
Earthcraft, a basic land and Squirrel Nest can be used for generating infinite Squirrels (You tap the enchanted land to create a Squirrel, then you tap the Squirrel to untap the enchanted land).
Opponent casts Tyrant of Discord which states:
When Tyrant of Discord enters the battlefield, target opponent chooses a permanent he or she controls at random and sacrifices it. If a nonland permanent is sacrificed this way, repeat this process.
In response to this, we generate 2256 Squirrel tokens. Now the Tyrant resolves and we have to start randomizing this. Obviously, impossible to do with dice in any reasonable amount of time unless immense luck is involved, so I thought I'd post here. The result has to be fair and all steps have to be random. Any basic random will do, though, no need to improve on that.
To reiterate the problem, we have X land permanents, Y nonland permanents and 2256 squirrels. We randomly pick one from all of these, remove it from the board, if it was not a land permanent we repeat the process. Question: Once this process ends, what land permanents, nonland permanents and how many squirrels remain?
r/programmingchallenges • u/babygame • Jun 01 '11
Coloring a grid
Make a program to color in the squares of an (n x m) grid (with some number of colors > 2) such that no two same colors touch.
There is a 'brute force' way, and (at least one) more 'elegant' solution as well.
Edit: I didn't specify-- try one that will output a different pattern each time. It's a nicer problem, I think :)
r/programmingchallenges • u/codeobserver • Jun 20 '19
50 micro coding challenges for beginners
This is a list of 50 micro coding challenges intended for beginners that just learned the basis of JavaScript language. Solve them to improve or test your coding skills and language understanding.
Although the challenges are designed for codeguppy.com learners, the challenges are platform agnostic so any JavaScript beginner can have fun with them.
What coding environment to use?
We recommend using an online JavaScript coding environment that allows you to share your code with others if you decide so. codeguppy.com is one option, but any other online JavaScript playground will work just fine.
Note: Very few challenges are JavaScript specific so feel free to try them in your preferred language.
Coding challenges
Print numbers from 1 to 10.Note: If you are using codeguppy.com, use can use the the println() function to print directly on the screen, otherwise use console.log() to output in the browser console.
Print the odd numbers less than 100
Print the multiplication table with 7
Print all the multiplication tables with numbers from 1 to 10
Calculate the sum of numbers from 1 to 10
Calculate 10!
Calculate the sum of even numbers greater than 10 and less than 30
Calculate the sum of numbers in an array of numbers
Calculate the average of the numbers in an array of numbers
Create a function that receives an array of numbers as argument and returns an array containing only the positive numbers
Find the maximum number in an array of numbers
Print the first 10 Fibonacci numbers without recursion
Create a function that will find the nth Fibonacci number using recursion
Create a function that will return a boolean specifying if a number is prime
Calculate the sum of digits of a positive integer number
Print the first 100 prime numbers
Create a function that will return in an array the first “p” prime numbers greater than “n”
Rotate an array to the left 1 position
Rotate an array to the right 1 position
Create a function to reverse an array and return the result as a new array
Create a function that will merge two arrays and return the result as a new array
Create a function that will receive two arrays of numbers as arguments and return an array composed of all the numbers that are either in the first array or second array but not in both
Create a function that will receive two arrays and will return an array with elements that are in the first array but not in the second
Create a function that will receive an array of numbers as argument and will return a new array with distinct elements
Calculate the sum of first 100 prime numbers and return them in an array
Print the distance between the first 100 prime numbers
Create a function that will add two positive numbers of indefinite size. The numbers are received as strings and the result should be also provided as string.
Create a function that will return the number of words in a text
Create a function that will capitalize the first letter of each word in a text
Calculate the sum of numbers received in a comma delimited string
Create a function that returns the number of occurrences of each word inside a text. The return will be an array with objects inside {word, count}
Create a function to convert a CSV text to a “bi-dimensional” array
Create a function that converts a string to an array of characters
Create a function that will convert a string in an array containing the ASCII codes of each character
Create a function that will convert an array containing ASCII codes in a string
Implement the Caesar cipher as a single function encryptDecrypt(text, key);
Implement the bubble sort algorithm for an array of numbers
Create a function to calculate the distance between two points defined by their x, y coordinates
Create a function that will return a Boolean value indicating if two circles defined by center coordinates and radius are intersecting
Create a function that will receive a bi-dimensional array as argument and a number and will extract as a unidimensional array the column specified by the number
Create a function that will convert a string containing a binary number into a number
Create a function to calculate the sum of all the numbers in a jagged array (contains numbers or other arrays of numbers on an unlimited number of levels)
Find the maximum number in a jagged array of numbers or array of numbers
Deep copy a jagged array with numbers or other arrays in a new array
Create a function to return the longest word in a string
Shuffle an array of strings
Create a function that will receive n as argument and return an array of n random numbers from 1 to n. The numbers should be unique inside the array.
Find the frequency of letters inside a string. Return the result as an array of arrays. Each subarray has 2 elements: letter and number of occurrences.
Calculate Fibonacci(500) with high precision (all decimals)
Calculate 70! with high precision (all decimals)
Have fun… and don’t forget to share your solutions or comment about your progress. If you are a Twitter user, you can also tweet about your progress with hashtag #codeguppychallenge
r/programmingchallenges • u/codeeval • May 02 '11
CodeEval (www.codeeval.com)- A site for employers / freelancers to ask / solve programming challenges
Hello,
My name is Jim and I am the founder of CodeEval (www.codeeval.com) a site where you can solve programming challenges in a variety of languages. Just thought I would let you folks know about it. Freelancers / Students etc can always log in for free and solve challenges for fun/fame.
thx Jim
If you have any feedback etc just send mail to support@ <domain name>
r/programmingchallenges • u/JanCumin • Jan 01 '19
Help bring Wikipedia to rural schools through an offline Wikipedia app
Hi all
I work at UNESCO and see a huge number of projects in schools that use Wikipedia, both online and offline. Only around 50% of the world has access to the internet, in many places internet can be slow, unreliable or even censored. Many schools in developing countries use textbooks that are many years even 10s of years old.
Kiwix is an offline solution created by a not for profit that allows you to access educational content like Wikipedia, the Wiktionary, TED talks and many others on any computer or smartphone - without the need for a live internet connection.
Currently the Kiwix app for Android and IOS allows people to view the content on their phone but to create a hotspot you need to use a Raspberry Pi or other hardware that is very cost prohibitive to the end users.
I'm trying to find developers who can help add the ability to create a Wikipedia hotspot in the Kiwix app, which would allow people to use their existing phones to create a hotspot in their school or community. This would greatly reduce the money and skills needed to use offline Wikipedia and allow many more people to access it. Please do take a look at the GitHub issue if you're able to help.
https://github.com/kiwix/kiwix-android/issues/259
Thanks very much
r/programmingchallenges • u/amstan • Oct 21 '11
AI Challenge Fall 2011 - Ants Now Open
aichallenge.orgr/programmingchallenges • u/babygame • Jun 01 '11
I want to program some games for my kid...
I'm learning python (and programming in general) by making games for my son. I've made a bubble popping game and one where you dial phone numbers to call various characters and hear a voice message.
I'm looking for more not-too-difficult games/challenges. Any ideas?
r/programmingchallenges • u/realestLink • Dec 14 '19
[Meta] About this sub
Recently there have been many off topic posts. I thought this sub was supposed to be about programming challenges. It has become tech support & learnprogramming. I don't know what the mods are doing. Also. There is a decreasing amount of challenges being posted here. I just thought I'd post this to vocalize what I've seen. I don't know if anything will become of it. Cheers :)
r/programmingchallenges • u/RogerioPenchel • Nov 20 '15
Code vs Zombies - You have 24H to build and optimize a piece of code able to get rid of all the zombies around you!
r/programmingchallenges • u/sharkdp • Nov 02 '15
Two robots on an infinite line
david-peter.der/programmingchallenges • u/sebzim4500 • Oct 17 '11
Very hard informatics Olympiad question. Use whatever language you want.
olympiad.org.ukr/programmingchallenges • u/mtrn • Feb 03 '12
Old Enigma Cipher Challenge
r/programmingchallenges • u/nickwhitecode • Nov 06 '19
160 LeetCode Algorithm Video Solutions
r/programmingchallenges • u/TheArtOfKane • Jul 30 '19
Awake / Asleep Cryptography Problem
r/programmingchallenges • u/monica_b1998 • Jun 30 '19
Physics sandbox in JavaScript
r/programmingchallenges • u/[deleted] • Dec 07 '18
Can you crack the code without looking at comments.
r/programmingchallenges • u/mtrn • Jun 06 '12
Want an interview at Facebook? Facebook will review the top entries in the competition and offer you an interview if they like what they see.
r/programmingchallenges • u/thechipsandgravy • Sep 29 '11
Challenge: Two Palindromes
You are given a string S of no more than 20 lowercase alphabetical letters and an integer N. Imagine a list L of strings that consists of all the unique permutations of S. Concatenate all strings in L to form a string B. You may remove any number of characters from B to form a palindrome P1. Again remove any number of characters from B to form another palindrome P2. Repeat this process to form N palindromes P1...PN. Given the restriction that all of these palindromes must be of equal length, what is the maximum length of P1?
r/programmingchallenges • u/HelpingHand007 • Nov 11 '19
Array Manipulation Hackerrank Solution | Difference Array | Range Update Query In O(1)
r/programmingchallenges • u/floralgnome • Dec 25 '18
How to code something to the effect of "I love you"?
My boyfriend is a programmer and works mainly with angular, c sharp, and I think Java script (I think he works with a few others but it's hard for me to keep up).
Anyways, obviously programming languages don't clearly translate like another language. But I want my first time telling him I love him to be in one of the programming languages he uses. Can someone help me?!?!?
Tldr: can you code something that says "I love you!" For me?