There are 3 baskets of fruits with worng lables,one basket
has apple,another basket has orange,another has combination
of apple and orange,what is the least way of interchange
the lables.
Answer Posted / anoop
Beside answer 3, following is one more alternative:
Let the 3 baskets with labels A,O,M.
Interchange labels of any 2 baskets. (assume that u
interchanged lables of A & O)
Now see (or take out) the fruits of either of the baskets
with changed labels (A & O).
There wud be 2 cases:
1. This basket(the one of which u saw (or took out) the
fruits) has fruits not conforming to the label.
2. This basket(the one of which u saw (or took out) the
fruits) has fruits conforming to the label.
If (1) is true,just interchange its label with the third
untouched basket (basket with label M).
If (2) is true, just interchange label of other basket with
the third untouched basket (basket with label M).
Idea is : Just one interchange of labels of any 2 basket
will fix one basket with correct label. In second step you
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What is the purpose of main( ) in c language?
what are non standard function in c
What's the difference between constant char *p and char * constant p?
What is the function of this pointer?
Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc
What is a string?
Why does notstrcat(string, "!");Work?
What is sizeof array?
Explain what is operator promotion?
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
What is the benefit of using #define to declare a constant?
How can I do serial ("comm") port I/O?
Explain pointer. What are function pointers in C?
What do you mean by dynamic memory allocation in c? What functions are used?
How are pointers declared in c?