ALL


  Collection Of Puzzles For Programmers

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 Friday the ThirteenthsThe goal is to identify all friday the thirteenths for a given timeframeRegular PentagonGiven 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",...

4,770 0       ASCII PROGRAMMING PUZZLE FIBONACCI PRIME


  Python Patterns - An Optimization Anecdote

The other day, a friend asked me a seemingly simple question: what's the best way to convert a list of integers into a string, presuming that the integers are ASCII values. For instance, the list [97, 98, 99] should be converted to the string 'abc'. Let's assume we want to write a function to do this.The first version I came up with was totally straightforward: def f1(list): string = "" for item in list: string = string + chr(item) return stringThat can't be the fastest way to do it, said my friend. How about this one: def f2(list): return reduce...

10,771 0       OPTIMIZATION PYTHON ANECDOTE LOOPUP ASCII