« Flow Control - One thing leads to another ! | Main | Algorithmic Complexity »

Riddles and more ...

Fascinating as it is, riddles are a good thing to hone ones thinking and break habits of short_attention_span. So I thought I should try a bit. On the other side of it is to see if there are brute force approach to solve some of those programmatically.

So I started my iGoogle a while back, but never had the curage of really trying some of those. I was more interested about weather, sports and other stuff. Yesterday I saw one popped up on my screen. It says that "You have a 10 digit number, the alphabet for this number is, we all know is from the set {0,1,...9}. We need to come up with a number that indicates the number of identical digits in its position. So if the leftmost position is 0, then for that number to be found, we place how many zeros in it. Similarly the 1st position will have the number of ones, and so on".

 

For a 10 digit number, the range is [ 0000000000, 9999999999].  A brute force approach to take one at a time a validate would be pretty time consuming even for a program!!!

 

So I started with the easy one, meaning how many zeros I can put in the number and still get away with the stipulated conditions. 9000000000. But I have to put 1 at the 9th position. Note the indexing is zero based. But that number failed, so I thought, start with 8 zeros. And it came out 800000010. Bang!

Not sure how many of such numbers exists within that range, but perhaps we can try a brute force algorithm, but can we use some backtracking here? Did not think thru it yet :)

And another one I saw was about permutation cycles. I did not try to solve it. It would be interesting to solve, because it has a strong mathematical structure, so thinking from a non mathematical side would be the challenge I want by brain to take. Reasons?. Mathematics is good, rigorous, but intuition is an weapon that leads to sleek solutions to problems.

Well, if one gets half-hour time a day, I would strongly encourage to try some of them.

 

Posted on Saturday, January 22, 2011 at 09:53AM by Registered CommenterProkash Sinha | CommentsPost a Comment | References1 Reference

References (1)

References allow you to track sources for this article, as well as articles that were written in response to this article.
  • Response
    Response: editing writing
    The little more development can be development regarding to the main side. These are the main source of the collecting information as well. This is known as the first development as well.

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.