wood burning stoves*
The moose likes Programming Diversions and the fly likes Hat Riddle: Require Java Algorithm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "Hat Riddle: Require Java Algorithm" Watch "Hat Riddle: Require Java Algorithm" New topic
Author

Hat Riddle: Require Java Algorithm

Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

There is a collection of 5 hats,of different style and colours,A Person goes on Travel,while on Travel he has chose & wear a hat such that the hat is of different style only, and the colour of the hat has to be different/repeated.Write a java algorithm for chosing such a hat ?


When The Going Gets Tougher,The Tougher gets Going
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11477
    
  16

Deepak Lal wrote:Write a java algorithm for chosing such a hat ?

I would argue there is no such thing as a 'java algorithm'.

algorithms are language neutral. if you have an algorithm, you should be able to implement it in any language.

having said that, I don't even understand the problem. What do you mean 'different style only'? Different from what?

and "the color...has to be different/repeated". again, different from what? and repeated how/when/where?


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11506
    
  95

Crossposted to this StackOverflow topic. Deepak - please read this.


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

i have to agree, i can't understand the "problem" from the way it is worded.


SCJP
Visit my download page
Myke Enriq
Ranch Hand

Joined: Feb 13, 2012
Posts: 115
Deepak Lal wrote:There is a collection of 5 hats,of different style and colours,A Person goes on Travel,while on Travel he has chose & wear a hat such that the hat is of different style only, and the colour of the hat has to be different/repeated.Write a java algorithm for chosing such a hat ?


my good man , your English is bad. Please use the translation tool from google , and read its result then correct it if necessary , then post it here.

Your question sound interesting , but I cannot fully understand it from your post.

I think java algorithm means and algorithm that is optimized by the use of java - this could be a tricky and fun riddle to solve.
Please post the question again , you made me curious.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hat Riddle: Require Java Algorithm