Did you know that we have a nice collection of puzzles here on less than dot? Some are harder than others so there is something for everyone. You can pic any language you want, you will see that there are solutions in Ruby, Python, Visual Basic, SQL, JavaScript, C++ and other.
Here is a partial list of what we have
The goal is to identify all friday the thirteenths for a given timeframe
Given a grid co-ordinate (x,y) as the centre point of a regular pentagon, and the sum of the length of the sides, return the co-ordinates of each point as: “Top”, “MidLeft”, “MidRight”, “BottomLeft”, “BottomRight” and the distance from the centre to each of the points.
Create some ASCII art in the shortest code possible
Find every prime number between 0 and 1,000,000
Calculating the Fibonacci Sequence
Calculate ‘X’ numbers in the Fibonacci Sequence, which is essentially adding the previous 2 occurring numbers together to make the next
Let’s say you have the following 4 items:
C:dataoldone.jpg
C:dataoldone.two.jpg
C:datanewnewerthree.wav
C:Documents and SettingsMy MusicAmazon MP3The DoorsGloria.mp3
You have to split this data and also show how many folders are in the path
format bytes and add postfixes
Given a numerical input of bytes, create a function to format the output to two decimal places along with the relevant postfixes
Convert Between Roman and Arabic Numerals
Write a program to convert to (and from) roman numerals. So your program should be able to take the input of 27 and return XXVII, and take MCMLXXXI and return 1981. And of course any other values.
Given an array of 1001 elements which contains integers from 1 to 1000 inclusive. The numbers are randomly stored in the array. Only one number repeats itself
First create the array randomly and the one number randomly. But use 10 million integers plus one of course. Do this 10 times and show the times it takes to find the number and then the average time
Write a program that will take two dates as inputs, and output the number of weekends between them.
Create the most unique way of writing “Hello World” – the more fantastic, cryptic, oddball the better
Calculate the phase of the moon as accurately as possible.
We all know that a moon month is not as long as a normal month. It is about 29.53 days long, but that is an average and not very accurate
Given an array of characters that form a sentence, give an efficient algorithm to reverse the order of the words (not characters) in it.
Reduce the size of the text in a single transportable file. Then inflate that same file to reproduce the original string exactly (e.g. lossless compression)
The challenge is to identify falsification of data sets. Given a set of numbers of natural source (e.g. naturally occuring like credit card payments, not machine/human generated like a telephone number), the program needs to identify the probability of that data being naturally occuring vs. being falsified.
Take numbers between 1 and 100
Take numbers between 1 and 100 and do the following
if the number is a prime mark it
if the number is divisible by 5 mark it
if the number is divisible by 7 mark it
if the number is divisible by 7 and 5 mark it
Making a simple calendar, I find that all these months with a different number of days is confussing. So I would like to have a calendar with 30 days per month from now on and 12 months a year. The only problem is that It will no longer be going with the sun. The sun being a 365 day/year cycle the new calendar has 360 days/year. So I need to compensate but only by adding a 13 month at certain years. Write me a program that calculates when to add a month to keep in synch more or less
You should give all the possible combinations to pay for the given amount of money.
knowing that you have the following currency
1 chrissiecent
2 chrissiecent
5 chrissiecent
10 chrissiecent
20 chrissiecent
50 chrissiecent
1 chrissie
2 chrissie
also give the solution with the least amount of pieces.
A man earns a certain amount of chrissies a month he has to pay 15% taxes and every year he has to pay 0.5% taxes more than the year before. The man’s income is indexed each year by 1%. When will that man’s net income be 200% of his begin income
Given the coordinates of the line segment, calculate the shortest distance to a given point. The distance that you are to calculate is represented by the red line. If the point is ‘outside’ the line segment, meaning, you cannot draw a perpendicular line to it, then you should return the distance from the given point to the closest end point
Keep an eye on Programmer Puzzles because every 2 weeks or so we post a new puzzle
Also check out our Google Interview Questions