Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-274937
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-274974
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-274997
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-275017
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-275020
Share on other sites

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
?>

Link to comment
https://forums.phpfreaks.com/topic/55641-problem-question-2/#findComment-275217
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.