FRESHERSHOME
Freshers Forum

Korn Shell Puzzle?

This is a discussion on Korn Shell Puzzle? within the Puzzles forums, part of the Freshers Zone category; Korn Shell The 26 alphabetic keys on a standard keyboard have been randomly swapped. A user comes by and tries ...


Go Back   Jobs in India Forum > Freshers Zone > Puzzles

Notices

Puzzles A puzzle is a problem or enigma that challenges ingenuity. Puzzles are often contrived as a form of entertainment, but they can also stem from serious mathematical or logistical problems, All Puzzle related Information and q&a

 
Reply
 
Thread Tools Display Modes
  #1  
Old 09-27-2007, 07:31 PM
YahooHoo
 
Join Date: Sep 2007
Posts: 1
Default Korn Shell Puzzle?

Korn Shell

The 26 alphabetic keys on a standard keyboard have been randomly swapped.

A user comes by and tries to type his name on the keyboard, pressing the key labeled with the letter he intends to type. Since the keys have been swapped, a different set of letters appears on the screen when he does this.

He looks at the new letters that have appeared on the screen and types those in, producing a new set of letters. He decides that it would be fun to continue doing this, and proceeds to keep typing in each new set of letters as they appear.

As it happens, after doing this a certain number of times, his real name will actually appear on the screen correctly. For example, given a particular swapping, the output might look like the following:

Jodt Dabn
Kafh Flcn
Dlmw Mgzn
Fgjq Jixn
Mike Korn

Given a particular name (e.g. "Mike Korn"), what is the maximum number of times the user might have to try typing in his name (or whatever has appeared on the screen) until his real name appears, if the manner in which the keys have been mixed up is unknown?

Write a program to compute this given a name as input. Your program should take a name (first name, last name; it should certainly not have any problem taking three-word names as well) as a command-line argument and output the answer:

$ ./korn Mike Korn
[the answer]

You may use any of the following programming languages:

* C++
* Java
* JavaScript
* OCaml/SML
* Perl
* PHP
* Python

For extra credit, you may submit additional solutions in the other languages as well as solutions in languages not listed here.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
korn, shell, puzzle

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump

Sitemap
Jobs by Location: Advertising and Marketing Jobs - IT Software Jobs - Walk-in Jobs - BPO Jobs - Government Jobs - Sales / BD Jobs - Tele Communication Jobs App Programming - Network Admin

Jobs By Location: Jobs in Bangalore - Jobs In India - Jobs in Delhi - Jobs in Hyderabad - Jobs in Kochi - Jobs in Mumbai - Jobs in Trivandrum - Jobs in pune - Jobs in Jonida - Jobs in Chennai - Jobs in Coimbator

Jobs Type: Full Time Jobs - Part Time Jobs
Latest Jobs - Accounting Jobs - Engineering Jobs - IT Jobs - Walkins - How to Face Interview - HR Round Tips - Career Info - Guide For Freshers - Apply for Jobs - Future Studies - Jobs Forums - Freshers IT Software Salary Details


All times are GMT +6.5. The time now is 12:14 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
FreshersHome.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62