↳
Swaz answer is almost correct however it does not work in all scenarios. lets assume: box 1 is labelled Oranges (O) box 2 is labelled Apples (A) box 3 is labelled Apples and Oranges (A+O) and that ALL THREE BOXES ARE LABELLED INCORRECTLY" Pick a fruit from box 1, 1) if you pick an Orange: - box 1's real label can only be O or A+O - box 1's current label is O - since ALL LABELS ARE INCORRECT then box 1's real label can not be O - box 1's new label should then be A+O by elimination - since ALL LABELS ARE INCORRECT - box 2's label is changed to O - box 3's label is changed to A - SOLVED 2) if you pick an Apple: - box 1's real label can only be A or A+O - box 1's current label is O - since ALL LABELS ARE INCORRECT then box 1's real label can not be O - this still leaves us with the choice between label A and label A+O - which would both be correct - FAILURE Solution: The trick is to actually pick a fruit from the A+O labeled box Pick a fruit from box 3: 1) if you pick an Orange: - box 3's real label can only be O or A - box 3's current label is A+O - since ALL LABELS ARE INCORRECT then box 3's real label can not be A+O - box 3's new label should then be O by elimination - since ALL LABELS ARE INCORRECT - box 1's label is changed to A - box 2's label is changed to A+O - SOLVED 2) if you pick an Apple: - box 3's real label can only be O or A - box 3's current label is A+O - since ALL LABELS ARE INCORRECT then box 3's real label can not be A+O - box 3's new label should then be A by elimination (not O) - since ALL LABELS ARE INCORRECT - box 1's label is changed to A+O - box 2's label is changed to O - SOLVED Moins
↳
It's easier to draw it out. There are only 2 possible combinations when all labels are tagged incorrectly. All you need to do is pick one fruit from the one marked "Apples + Oranges". If it's Apple, then change "Apple + Orange" to "Apple" The "Apple" one change to "Orange" The "Orange one change to "Apple + Orange" If it's Orange, then change "Apple + Orange" to "Orange" The "Apple" one change to "Apple + Orange" The "Orange" one change to ""Apple" Moins
↳
All the three boxes are names incorrectly. SO the bax lebeled Apples+Oranges contains only Oranges or Only Apples. Pick one fruit from it. If it is Orange then lebel the box as Orange. So the box lebeled Oranges contains Apples and the remaining contains both. Moins
↳
SC calculated the correct probability of getting WRONG socks if allowed to ONLY take 2 single socks from a mix of 19 single grey and 25 single black socks. The correct calculation is 942/1892 is the actual chance of getting a pair of either colour (don't care if they match the suit - since I don't know what colour suit I'm wearing, as it's dark, just that they match each other). This is 49.7%. Since this is less than an even bet, it is probably time to look for a creative solution (after providing the correct answer of course). I'm disappointed none of you checked the maths before providing the standard '3 socks make a pair' response - which I prefer anyway - or the selection of brilliant lateral thinking responses. (My wife kindly pairs my socks as I' colour blind anyway - so they always match each other - but seldom match my clothing.) Tara has obviously not read the question - 3 grey or 3 black socks does provide a matching pair. If I want a matching pair which ALSO matches my suit - then I need to be allowed more socks - 21 if I want a black pair, 27 if I want a grey pair - or of course 27 in the worst case if I don't know what suit I'm wearing, and it happens to be grey. Moins
↳
There are (25 choose 2) unique combinations of black + (19 choose 2) unique combinations of grey out of a total of ((25+19) choose 2) unique combinations. 25 choose 2 = 25! / (2! * (25 - 2)!) = 300 19 choose 2 = 19! / (2! * (19 - 2)!) = 171 44 choose 2 = 44! / (2! * (44 - 2)!) = 946 (300 + 171) / 946 = 0.4979 = 49.79% probability, same as concluded by Mickey's correction of SC. Sorry 2easy, time to brush up on your probabilities. Moins
↳
You could give the precise answer as above (be SC) or, more simply, you could tell them you grab three socks as two of them will match for sure. Moins
↳
Think broadband communication. Exploit the capabilities of the communications medium. A minimum of nine dwarves can be saved based on the information provided in the original post I viewed. The strategy is for each dwarf to employ the expected language to communicate the color of their own hat to the giant, while simultaneously employing a vocal pitch protocol to indicate the color of the hat of the dwarf in front of him, high pitch for white and low pitch for black. The original post, indicates the dwarves may collude prior to the distribution of hats, so there is opportunity to negotiate such a simple broadband communication protocol. The tallest dwarf only has a 50/50 chance since the number of black and white hats in play is not known (rhetorical question, what are the odds the tallest dwarf's hat is black if he turns to find that all nine hats in front of him are white? I don't know, but odds are high that the giant is a sadistic bloke). The original post I viewed is here. http://www.businessinsider.com/toughest-job-interview-questions-2013-7#a-dwarf-killing-giant-lines-up-10-dwarfs-from-shortest-to-tallest-each-dwarf-can-see-all-the-shortest-dwarfs-in-front-of-him-but-cannot-see-the-dwarfs-behind-himself-the-giant-randomly-puts-a-white-or-black-hat-on-each-dwarf-no-dwarf-can-see-their-own-hat-the-giant-tells-all-the-dwarfs-that-he-will-ask-each-dwarf-starting-with-the-tallest-for-the-color-of-his-hat-if-the-dwarf-answers-incorrectly-the-giant-will-kill-the-dwarf-each-dwarf-can-hear-the-previous-answers-but-cannot-hear-when-a-dwarf-is-killed-the-dwarves-are-given-an-opportunity-to-collude-before-the-hats-are-distributed-what-strategy-should-be-used-to-kill-the-fewest-dwarfs-and-what-is-the-minimum-number-of-dwarfs-that-can-be-saved-with-this-strategy-11 Moins
↳
What is the minimum number of dwarfs that can be saved with this strategy? 9 First of all, let's numerate the dwarfs as N1, N2, N3, etc. with N10 being the tallest. Now, N10 will state the color of N9 as his own answer, "My hat is WHITE". Based on this answer, N9 will state his color with a positive statement if the color of N8 is the same as his, "My hat is WHITE". Based on N8's answer, N8 knows that his color is WHITE, now, he will state his color depending on N7. Let's say N7 is black, so N8 will state, "My hat is NOT BLACK". N7 knows that his color is BLACK, but N6 is white, so he will use a negative statement, "My hat is NOT WHITE" and so on. Full example: N10 = BLACK N9 = WHITE N8 = WHITE N7 = BLACK N6 = WHITE N5 = WHITE N4 = WHITE N3 = BLACK N2 = BLACK N1 = WHITE N10: My hat is WHITE (Dies) N9 = My hat is WHITE N8 = My hat is NOT BLACK N7 = My hat is NOT WHITE N6 = My hat is WHITE N5 = My hat is WHITE N4 = My hat is NOT BLACK N3 = My hat is BLACK N2 = My hat is NOT WHITE N1 = My hat is WHITE N10 will have a 50/50 chances of survival... I'm sorry N10, I couldn't save you :'( Moins
↳
the question does not mention that there will be equal number of white and black hats ! Moins
↳
public static void UnionOfStrings() { String s1 = "XYZ"; String s2 = "YZOP"; String s3 = s1.concat(s2); char ch[] = s3.toCharArray(); Set setChars = new TreeSet(); for(char c : ch) { setChars.add(c); } System.out.println(setChars.toString()); } Output : [O, P, X, Y, Z] Moins
↳
public static void IntersectionOfStrings() { String s1 = "XYZYYP"; String s2 = "YZOPP"; Set setChars = new TreeSet(); char c[] = s1.toCharArray(); for(char x : c) { if(s2.indexOf(x)!=-1) { setChars.add(x); } } System.out.println(setChars.toString()); } OUTPUT : [P, Y, Z] Moins
↳
public static void IntersectionOfStrings() { String s1 = "yybbb78"; String s2 = "y7"; if(s1.length() > s2.length()) intersect(s1,s2); else intersect(s2,s1); } public static void intersect(String first, String second) { Set setChars = new TreeSet(); char c[] = first.toCharArray(); for(char x : c) { if(second.indexOf(x)!=-1) { setChars.add(x); } } System.out.println(setChars.toString()); } Moins
↳
I actually had an interview with Clearleap yesterday and I can tell you that above comments are not true. Interview process was very professional. Problem solving questions were quite interesting and I enjoyed them! Moins
↳
Unfortunately, your response is quite immature and therefore I withdraw myself from this conversation. Moins
↳
4 people actually (you missed the requirement). Looks like you did not pay attention during the interview. These types of questions are designed to figure out your: a) Problem solving skills b) Creativity c) Ability to work under pressure And most of all to observe your thought process. But in your Senior QA Engineer role you should have know about that already, right? Moins
↳
hey buddy can you please contact me at vishuvashishth3@gmail.com
↳
hey..can someone plz help me out with some expected questions/word puzzles in d 4rth round? i have my interview tomorrow.. My id is aliyashaista@gmail.com Moins
↳
performance testing is a subset of performance engineering, which is focused on addressing performance issues in the design and architecture of a software product.stress testing evaluates the behavior of an application beyond peak load and normal conditions. Moins
↳
Good work. I checked your code and it runs. This is a variation on the classic FizzBuzz coding question. One suggestion: You can simplify your code by printing the user prompt in the input function. # i = input("Enter a number or press Q to quit:") Another suggestion: Make the letter "q" case insensitive by passing the ".lower()" method after your input string # i = input("Enter a number or press Q to quit:").lower() One thing: You don't need the following if clause which I've commented out. This condition is already checked and handled outside of the try block. """ try: n = int(i) # if i == "q": # print("Goodbye!") """ Moins
↳
Use string builder to improve the run time.
↳
public static String printAnimal(int num) { if (num >= 8 && num = 16 && num = 16 && num < 32) { if (num % 32 == 0) { return "ANIMAL"; } } return "Number Not Divisible by 8"; } Moins
↳
Maybe I'm having a bad day, but I don't get why F. is the answer.
↳
I believe it's E, not F. If A is true, B has to be true - contradiction. If B is true, D is also true - contradiction. If C is true, A and B have to be true, but they are not. D can't be true because we already ruled out all of those above D. (skip E) F can't be true because E would also be true, which contradicts F. (back to E) E may be true because we did rule out all of the above. And if E is true then F is false, which is also consistent. Moins
↳
This is incorrect. E only states that the letters above are incorrect, but does not disprove F. Thus, E also includes F as a true statement. However, F disproves the truth of E. Therefore the only answer does that is not contradicted by anything else is F. Moins