nadeemshafi9 Posted June 14, 2007 Share Posted June 14, 2007 hello guys question from interviwer. you have 8 balls one of wich weigs more than the others but they are all the same size, you have some old fasion 2 part scales, you can only use the scales twice, how do you find the heavyiest ball ? thanks for any help Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/ Share on other sites More sharing options...
Orio Posted June 14, 2007 Share Posted June 14, 2007 You weight 3 and 3. If one of the sides is heavier, you take two out of the 3 balls and weight them. If one is heavier then you found it. If they are the same it's the third one you haven't chosen. If both side were the same you simply check which ball out the two you haven't used is heavier. You can do this with 9 balls too. Orio. Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-274937 Share on other sites More sharing options...
nadeemshafi9 Posted June 14, 2007 Author Share Posted June 14, 2007 man, how do you know these, i mean realy if this is teh sirta thing they ask i better get good at it ? Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-274946 Share on other sites More sharing options...
Orio Posted June 14, 2007 Share Posted June 14, 2007 There aren't too many possiblilities, you need to think how to eliminate the most. Orio. Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-274947 Share on other sites More sharing options...
nadeemshafi9 Posted June 14, 2007 Author Share Posted June 14, 2007 can you direct me towards some kind of learning medium for these like books or websites plz, Oh and thank you very much for your help. Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-274949 Share on other sites More sharing options...
Orio Posted June 14, 2007 Share Posted June 14, 2007 What do you mean? I don't know of books or websites about these riddles, you just gotta look for more and solve, open your mind. Oh and check my signature, maybe you'll like it. Orio. Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-274953 Share on other sites More sharing options...
nadeemshafi9 Posted June 14, 2007 Author Share Posted June 14, 2007 OMG you r the riddler himself. Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-274958 Share on other sites More sharing options...
nadeemshafi9 Posted June 14, 2007 Author Share Posted June 14, 2007 Can you tell me if this is the kind of stuff i will be asked by every interviwer ?, i have just done my first interview for .NET and i got two lined up for LAMP. Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-274970 Share on other sites More sharing options...
Orio Posted June 14, 2007 Share Posted June 14, 2007 lol I am just 16 years old Never been to a job interview hehe Orio. Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-274971 Share on other sites More sharing options...
nadeemshafi9 Posted June 14, 2007 Author Share Posted June 14, 2007 i have to say your maths skills are very good, the kind of people i think that ask these questions in an interview are the kind that come from very sophisticated mathamatical backgrounds, like im sure your going to be doing. Your a very smart lad witha very bright future m8. Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-274974 Share on other sites More sharing options...
nadeemshafi9 Posted June 14, 2007 Author Share Posted June 14, 2007 So how did u get into all of this riddleing buisness ? Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-274977 Share on other sites More sharing options...
redbullmarky Posted June 14, 2007 Share Posted June 14, 2007 it's not unusual for questions of a similar nature to be asked at interviews to see your reaction and how long you'll think about it for. some might think about it for a few seconds (or not at all) before giving in (ie, defeatist knowing they wont be able to do it, so dont even try). some might think for much longer and either get it or not. some will explain how they might go about trying to solve it, even if they dont actually do so (i'd probably fall into this category for puzzles and stuff like this). there are not too many regular people that can answer them without putting in some serious thought, and an interviewer doesnt plan sitting there all day whilst you solve puzzles - so dont worry too much about them. you say on your other topic that you got to one part - so obviously you started to tackle the problem the right way. explain this process to an interviewer, and my bet is it'd be almost as good an answer as giving the solution, for what he's looking for. coming up with a solution is not the be all and end all in many cases. problem solving is a huge part of programming/coding, yet most real situations wont require you to solve things like this on the spot - it's more about the way you approach and handle the task at hand. Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-274997 Share on other sites More sharing options...
nadeemshafi9 Posted June 14, 2007 Author Share Posted June 14, 2007 Thanks very much, youv made me calm down, i am learnign al the time thogh and to be honest i did think he wasted my time. But its fair enogh hes looking for somone like himself. Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-275014 Share on other sites More sharing options...
nadeemshafi9 Posted June 14, 2007 Author Share Posted June 14, 2007 but it was good toget out there for the first time and feel what the buisnesses are all about and look at the way they work and stuff, my next interview will be good, i did give a portfolio and talk about the DB's and in diff servers and diff languages and stuff and i was able to show spec to model to implementation, but he didnt care about it he only cared about the riddles. Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-275017 Share on other sites More sharing options...
nadeemshafi9 Posted June 15, 2007 Author Share Posted June 15, 2007 they gave me 20 mins to do all 4 there was another annoying one too. without using a specific programming language show the least amount of logical steps in order to sort your name ALPHABETICALY and print it on the screen ???????? i gave a fully blown bubble sort with an alphabetic array to check against and it was wrong. They said : just print the name in alphabetical order 1 STEP lol Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-275020 Share on other sites More sharing options...
trq Posted June 15, 2007 Share Posted June 15, 2007 They said : just print the name in alphabetical order 1 STEP lol In what language did they suggest this could be done with standard functions? Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-275148 Share on other sites More sharing options...
redbullmarky Posted June 15, 2007 Share Posted June 15, 2007 hmm <?php $name = "Mark"; $letters = array(); // put all letters of name into an array. // use the array key to store the original letter (ie, to maintain case) for($i = 0; $i < strlen($name); $i++) { $letter = $name[$i]; $letters[$letter] = strtolower($letter); } // sort array maintaining the keys asort($letters); // stick the keys together and output. $name = implode('', array_keys($letters)); echo $name; // outputs akMr ?> Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-275217 Share on other sites More sharing options...
Daniel0 Posted June 15, 2007 Share Posted June 15, 2007 Hardly one step... It seems impossible to me. Quote Link to comment https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-275260 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.