This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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: 10929
    
  12

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: 11285
    
  59

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: 4339
    
    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: 102
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
 
Similar Threads
NoSuchAlgorithmException after java 6 migration
AES encryption with JCE
Progress bar component.
WA #1.....word association
PA #1.....picture association