<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6149692539226863505</id><updated>2021-12-04T14:33:42.046-08:00</updated><category term="Interview Puzzle"/><category term="Lateral Thinking Puzzles"/><category term="Microsoft Puzzles"/><category term="Google Puzzle"/><category term="SoapUI"/><category term="Amazon Interview Puzzle"/><category term="Google Interview puzzles"/><category term="Image puzzles"/><category term="Induction Puzzles"/><category term="Automation Testing"/><category term="Einstein Puzzles"/><category term="Array"/><category term="C"/><category term="Coding Interview"/><category term="Feature"/><category term="Adobe Interview puzzles"/><category term="HR Interview Questions"/><category term="Infosys puzzles"/><category term="Trilogy interview puzzle"/><title type='text'>Interview Puzzles with answers.</title><subtitle type='html'>Blob about articles of How to interview, Programming puzzles,riddles and Automation questions.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.techinterviewpuzzles.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default?start-index=26&amp;max-results=25'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>73</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-7727840083436283786</id><published>2015-11-01T01:30:00.003-08:00</published><updated>2015-11-01T01:30:52.523-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Array"/><category scheme="http://www.blogger.com/atom/ns#" term="C"/><category scheme="http://www.blogger.com/atom/ns#" term="Coding Interview"/><title type='text'>Find a Number that Appears Only once in array of duplicates</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-X30tt9djEv4/VjXVzFZK6YI/AAAAAAAAAfg/x9WbpxFWkIE/s1600/systems_programming.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;http://3.bp.blogspot.com/-X30tt9djEv4/VjXVzFZK6YI/AAAAAAAAAfg/x9WbpxFWkIE/s320/systems_programming.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Given an array where every element occurs three times, except one element which occurs only once. Find the element that occurs once. Expected time complexity is O(n) and O(1) extra space.&lt;br /&gt;Examples:&lt;br /&gt;&lt;br /&gt;Input: arr[] = {12, 1, 12, 3, 12, 1, 1, 2, 3, 3}&lt;br /&gt;Output: 2&lt;br /&gt;&lt;br /&gt;We can use sorting to do it in O(nLogn) time. We can also use hashing, but the worst case time complexity of hashing may be more than O(n) and hashing requires extra space.&lt;br /&gt;&lt;br /&gt;The idea is to use bitwise operators for a solution that is O(n) time and uses O(1) extra space. The solution is not easy like other XOR based solutions, because all elements appear odd number of times here. The idea is taken from &lt;a href=&quot;http://www.careercup.com/question?id=7902674&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Run a loop for all elements in array. At the end of every iteration, maintain following two values.&lt;br /&gt;&lt;br /&gt;ones: The bits that have appeared 1st time or 4th time or 7th time .. etc.&lt;br /&gt;&lt;br /&gt;twos: The bits that have appeared 2nd time or 5th time or 8th time .. etc.&lt;br /&gt;&lt;br /&gt;Finally, we return the value of &#39;ones&#39;&lt;br /&gt;&lt;br /&gt;How to maintain the values of &#39;ones&#39; and &#39;twos&#39;?&lt;br /&gt;&#39;ones&#39; and &#39;twos&#39; are initialized as 0. For every new element in array, find out the common set bits in the new element and previous value of &#39;ones&#39;. These common set bits are actually the bits that should be added to &#39;twos&#39;. So do bitwise OR of the common set bits with &#39;twos&#39;. &#39;twos&#39; also gets some extra bits that appear third time. These extra bits are removed later.&lt;br /&gt;Update &#39;ones&#39; by doing XOR of new element with previous value of &#39;ones&#39;. There may be some bits which appear 3rd time. These extra bits are also removed later.&lt;br /&gt;&lt;br /&gt;Both &#39;ones&#39; and &#39;twos&#39; contain those extra bits which appear 3rd time. Remove these extra bits by finding out common set bits in &#39;ones&#39; and &#39;twos&#39;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush:c&quot;&gt;#include &lt;stdio .h=&quot;&quot;&gt;&lt;br /&gt; &lt;br /&gt;int getSingle(int arr[], int n)&lt;br /&gt;{&lt;br /&gt;    int ones = 0, twos = 0 ;&lt;br /&gt; &lt;br /&gt;    int common_bit_mask;&lt;br /&gt; &lt;br /&gt;    // Let us take the example of {3, 3, 2, 3} to understand this&lt;br /&gt;    for( int i=0; i&amp;lt; n; i++ )&lt;br /&gt;    {&lt;br /&gt;        /* The expression &quot;one &amp;amp; arr[i]&quot; gives the bits that are&lt;br /&gt;           there in both &#39;ones&#39; and new element from arr[].  We&lt;br /&gt;           add these bits to &#39;twos&#39; using bitwise OR&lt;br /&gt; &lt;br /&gt;           Value of &#39;twos&#39; will be set as 0, 3, 3 and 1 after 1st,&lt;br /&gt;           2nd, 3rd and 4th iterations respectively */&lt;br /&gt;        twos  = twos | (ones &amp;amp; arr[i]);&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;        /* XOR the new bits with previous &#39;ones&#39; to get all bits&lt;br /&gt;           appearing odd number of times&lt;br /&gt; &lt;br /&gt;           Value of &#39;ones&#39; will be set as 3, 0, 2 and 3 after 1st,&lt;br /&gt;           2nd, 3rd and 4th iterations respectively */&lt;br /&gt;        ones  = ones ^ arr[i];&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;        /* The common bits are those bits which appear third time&lt;br /&gt;           So these bits should not be there in both &#39;ones&#39; and &#39;twos&#39;.&lt;br /&gt;           common_bit_mask contains all these bits as 0, so that the bits can &lt;br /&gt;           be removed from &#39;ones&#39; and &#39;twos&#39;   &lt;br /&gt; &lt;br /&gt;           Value of &#39;common_bit_mask&#39; will be set as 00, 00, 01 and 10&lt;br /&gt;           after 1st, 2nd, 3rd and 4th iterations respectively */&lt;br /&gt;        common_bit_mask = ~(ones &amp;amp; twos);&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;        /* Remove common bits (the bits that appear third time) from &#39;ones&#39;&lt;br /&gt;             &lt;br /&gt;           Value of &#39;ones&#39; will be set as 3, 0, 0 and 2 after 1st,&lt;br /&gt;           2nd, 3rd and 4th iterations respectively */&lt;br /&gt;        ones &amp;amp;= common_bit_mask;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;        /* Remove common bits (the bits that appear third time) from &#39;twos&#39;&lt;br /&gt; &lt;br /&gt;           Value of &#39;twos&#39; will be set as 0, 3, 1 and 0 after 1st,&lt;br /&gt;           2nd, 3rd and 4th itearations respectively */&lt;br /&gt;        twos &amp;amp;= common_bit_mask;&lt;br /&gt; &lt;br /&gt;        // uncomment this code to see intermediate values&lt;br /&gt;        //printf (&quot; %d %d \n&quot;, ones, twos);&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;    return ones;&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;    int arr[] = {3, 3, 2, 3};&lt;br /&gt;    int n = sizeof(arr) / sizeof(arr[0]);&lt;br /&gt;    printf(&quot;The element with single occurrence is %d &quot;,&lt;br /&gt;            getSingle(arr, n));&lt;br /&gt;    return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/stdio&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.techinterviewpuzzles.com/feeds/7727840083436283786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.techinterviewpuzzles.com/2015/11/find-number-that-appears-only-once-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/7727840083436283786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/7727840083436283786'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2015/11/find-number-that-appears-only-once-in.html' title='Find a Number that Appears Only once in array of duplicates'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-X30tt9djEv4/VjXVzFZK6YI/AAAAAAAAAfg/x9WbpxFWkIE/s72-c/systems_programming.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-1772337688425162630</id><published>2015-11-01T01:45:00.001-07:00</published><updated>2015-11-01T01:23:58.841-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Array"/><category scheme="http://www.blogger.com/atom/ns#" term="C"/><category scheme="http://www.blogger.com/atom/ns#" term="Coding Interview"/><title type='text'>Find largest continuous sum in an array</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-X30tt9djEv4/VjXVzFZK6YI/AAAAAAAAAfc/M-E7bMpTSC4/s1600/systems_programming.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;http://4.bp.blogspot.com/-X30tt9djEv4/VjXVzFZK6YI/AAAAAAAAAfc/M-E7bMpTSC4/s320/systems_programming.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Write an efficient C program to find the sum of contiguous subarray  within a one-dimensional array of numbers which has the largest sum.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Kadane’s Algorithm:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: c&quot;&gt;Initialize:&lt;br /&gt;    max_so_far = 0&lt;br /&gt;    max_ending_here = 0&lt;br /&gt;&lt;br /&gt;Loop for each element of the array&lt;br /&gt;  (a) max_ending_here = max_ending_here + a[i]&lt;br /&gt;  (b) if(max_ending_here &amp;lt; 0)&lt;br /&gt;            max_ending_here = 0&lt;br /&gt;  (c) if(max_so_far &amp;lt; max_ending_here)&lt;br /&gt;            max_so_far = max_ending_here&lt;br /&gt;return max_so_far&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Explanation:&lt;/b&gt;&lt;br /&gt;Simple  idea of the Kadane&#39;s algorithm is to look for all positive contiguous  segments of the array (max_ending_here is used for this). And keep track  of maximum sum contiguous segment among all positive segments  (max_so_far is used for this). Each time we get a positive sum compare  it with max_so_far and update max_so_far if it is greater than  max_so_far&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Lets take the example:&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {-2, -3, 4, -1, -2, 1, 5, -3}&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: c&quot;&gt;    &lt;br /&gt;&lt;br /&gt;    max_so_far = max_ending_here = 0&lt;br /&gt;&lt;br /&gt;    for i=0,  a[0] =  -2&lt;br /&gt;&lt;br /&gt;    max_ending_here = max_ending_here + (-2)&lt;br /&gt;&lt;br /&gt;    Set max_ending_here = 0 because max_ending_here &amp;lt; 0&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    for i=1,  a[1] =  -3&lt;br /&gt;&lt;br /&gt;    max_ending_here = max_ending_here + (-3)&lt;br /&gt;&lt;br /&gt;    Set max_ending_here = 0 because max_ending_here &amp;lt; 0&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    for i=2,  a[2] =  4&lt;br /&gt;&lt;br /&gt;    max_ending_here = max_ending_here + (4)&lt;br /&gt;&lt;br /&gt;    max_ending_here = 4&lt;br /&gt;&lt;br /&gt;    max_so_far is updated to 4 because max_ending_here greater&lt;br /&gt;&lt;br /&gt;    than max_so_far which was 0 till now&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    for i=3,  a[3] =  -1&lt;br /&gt;&lt;br /&gt;    max_ending_here = max_ending_here + (-1)&lt;br /&gt;&lt;br /&gt;    max_ending_here = 3&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    for i=4,  a[4] =  -2&lt;br /&gt;&lt;br /&gt;    max_ending_here = max_ending_here + (-2)&lt;br /&gt;&lt;br /&gt;    max_ending_here = 1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    for i=5,  a[5] =  1&lt;br /&gt;&lt;br /&gt;    max_ending_here = max_ending_here + (1)&lt;br /&gt;&lt;br /&gt;    max_ending_here = 2&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    for i=6,  a[6] =  5&lt;br /&gt;&lt;br /&gt;    max_ending_here = max_ending_here + (5)&lt;br /&gt;&lt;br /&gt;    max_ending_here = 7&lt;br /&gt;&lt;br /&gt;    max_so_far is updated to 7 because max_ending_here is&lt;br /&gt;&lt;br /&gt;    greater than max_so_far&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    for i=7,  a[7] =  -3&lt;br /&gt;&lt;br /&gt;    max_ending_here = max_ending_here + (-3)&lt;br /&gt;&lt;br /&gt;    max_ending_here = 4&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;// C++ program to print largest contiguous array sum&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: c&quot;&gt;    &lt;br /&gt;#include&lt;iostream&gt;&lt;br /&gt;using namespace std;&lt;br /&gt; &lt;br /&gt;int maxSubArraySum(int a[], int size)&lt;br /&gt;{&lt;br /&gt;    int max_so_far = 0, max_ending_here = 0;&lt;br /&gt; &lt;br /&gt;    for (int i = 0; i &amp;lt; size; i++)&lt;br /&gt;    {&lt;br /&gt;        max_ending_here = max_ending_here + a[i];&lt;br /&gt;        if (max_ending_here &amp;lt; 0)&lt;br /&gt;            max_ending_here = 0;&lt;br /&gt;        if (max_so_far &amp;lt; max_ending_here)&lt;br /&gt;            max_so_far = max_ending_here;&lt;br /&gt;    }&lt;br /&gt;    return max_so_far;&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;/*Driver program to test maxSubArraySum*/&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;    int a[] = {-2, -3, 4, -1, -2, 1, 5, -3};&lt;br /&gt;    int n = sizeof(a)/sizeof(a[0]);&lt;br /&gt;    int max_sum = maxSubArraySum(a, n);&lt;br /&gt;    cout &amp;lt;&amp;lt; &quot;Maximum contiguous sum is \n&quot; &amp;lt;&amp;lt; max_sum;&lt;br /&gt;    return 0;&lt;br /&gt;}&lt;br /&gt;&lt;/iostream&gt;&lt;/pre&gt;&lt;br /&gt;Output:&lt;br /&gt;&lt;br /&gt;Maximum contiguous sum is 7&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Notes:&lt;/b&gt;Algorithm  doesn&#39;t work for all negative numbers. It simply returns 0 if all  numbers are negative. For handling this we can add an extra phase before  actual implementation. The phase will look if all numbers are negative,  if they are it will return maximum of them (or smallest in terms of  absolute value). There may be other ways to handle it though.&lt;br /&gt;&lt;br /&gt;Above program can be optimized further, if we compare max_so_far with max_ending_here only if max_ending_here is greater than 0.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush:c&quot;&gt;int maxSubArraySum(int a[], int size)&lt;br /&gt;{&lt;br /&gt;   int max_so_far = 0, max_ending_here = 0;&lt;br /&gt;   for (int i = 0; i &amp;lt; size; i++)&lt;br /&gt;   {&lt;br /&gt;       max_ending_here = max_ending_here + a[i];&lt;br /&gt;       if (max_ending_here &amp;lt; 0)&lt;br /&gt;           max_ending_here = 0;&lt;br /&gt; &lt;br /&gt;       /* Do not compare for all elements. Compare only   &lt;br /&gt;          when  max_ending_here &amp;gt; 0 */&lt;br /&gt;       else if (max_so_far &amp;lt; max_ending_here)&lt;br /&gt;           max_so_far = max_ending_here;&lt;br /&gt;   }&lt;br /&gt;   return max_so_far;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Time Complexity: O(n)&lt;br /&gt;Algorithmic Paradigm: Dynamic Programming&lt;br /&gt;&lt;br /&gt;Following is another simple implementation. The implementation handles the case when all numbers in array are negative.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush:c&quot;&gt;#include&lt;iostream&gt;&lt;br /&gt;using namespace std;&lt;br /&gt; &lt;br /&gt;int maxSubArraySum(int a[], int size)&lt;br /&gt;{&lt;br /&gt;   int max_so_far = a[0];&lt;br /&gt;   int curr_max = a[0];&lt;br /&gt; &lt;br /&gt;   for (int i = 1; i &amp;lt; size; i++)&lt;br /&gt;   {&lt;br /&gt;        curr_max = max(a[i], curr_max+a[i]);&lt;br /&gt;        max_so_far = max(max_so_far, curr_max);&lt;br /&gt;   }&lt;br /&gt;   return max_so_far;&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;/* Driver program to test maxSubArraySum */&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;   int a[] =  {-2, -3, 4, -1, -2, 1, 5, -3};&lt;br /&gt;   int n = sizeof(a)/sizeof(a[0]);&lt;br /&gt;   int max_sum = maxSubArraySum(a, n);&lt;br /&gt;   cout &amp;lt;&amp;lt; &quot;Maximum contiguous sum is &quot; &amp;lt;&amp;lt; max_sum;&lt;br /&gt;   return 0;&lt;br /&gt;}&lt;br /&gt;&lt;/iostream&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.techinterviewpuzzles.com/feeds/1772337688425162630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.techinterviewpuzzles.com/2015/11/find-largest-continuous-sum-in-array.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/1772337688425162630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/1772337688425162630'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2015/11/find-largest-continuous-sum-in-array.html' title='Find largest continuous sum in an array'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-X30tt9djEv4/VjXVzFZK6YI/AAAAAAAAAfc/M-E7bMpTSC4/s72-c/systems_programming.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-3094597432234265616</id><published>2015-11-01T01:22:00.000-07:00</published><updated>2015-11-01T01:24:11.033-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Array"/><category scheme="http://www.blogger.com/atom/ns#" term="C"/><category scheme="http://www.blogger.com/atom/ns#" term="Coding Interview"/><title type='text'>How to find the Largest Difference in an Array</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-X30tt9djEv4/VjXVzFZK6YI/AAAAAAAAAfg/x9WbpxFWkIE/s1600/systems_programming.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;http://3.bp.blogspot.com/-X30tt9djEv4/VjXVzFZK6YI/AAAAAAAAAfg/x9WbpxFWkIE/s320/systems_programming.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;b&gt;Question:&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;You have an array of integers:&amp;nbsp; int[] A = { 10, 3, 6, 8, 9, 4, 3 };&lt;br /&gt;&lt;br /&gt;My goal is to find the largest difference between A[Q] and A[P] such that Q &amp;gt; P.&lt;br /&gt;&lt;br /&gt;If P = 1 and Q = 4&lt;br /&gt;diff = A[Q] – A[P]&lt;br /&gt;diff = 9 – 3&lt;br /&gt;diff = 6&lt;br /&gt;&lt;br /&gt;Since 6 is the largest number between all the difference, that is the answer.&lt;br /&gt;&lt;br /&gt;The following code runs in O(n) and &lt;i&gt;should&lt;/i&gt; conform to the specification (preliminary tests on codility were successful):&lt;b&gt; &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush:c&quot;&gt;public int solution(int[] A)&lt;br /&gt;{&lt;br /&gt;    int N = A.Length;&lt;br /&gt;    if (N &amp;lt; 1) return 0;&lt;br /&gt;&lt;br /&gt;    int max = 0;&lt;br /&gt;    int result = 0;&lt;br /&gt;&lt;br /&gt;    for(int i = N-1; i &amp;gt;= 0; --i)&lt;br /&gt;    {&lt;br /&gt;        if(A[i] &amp;gt; max)&lt;br /&gt;            max = A[i];&lt;br /&gt;&lt;br /&gt;        var tmpResult = max - A[i];        &lt;br /&gt;        if(tmpResult &amp;gt; result)&lt;br /&gt;            result = tmpResult;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    return result;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.techinterviewpuzzles.com/feeds/3094597432234265616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.techinterviewpuzzles.com/2015/11/how-to-find-largest-difference-in-array.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/3094597432234265616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/3094597432234265616'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2015/11/how-to-find-largest-difference-in-array.html' title='How to find the Largest Difference in an Array'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-X30tt9djEv4/VjXVzFZK6YI/AAAAAAAAAfg/x9WbpxFWkIE/s72-c/systems_programming.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-6172775628401255871</id><published>2015-02-07T04:01:00.000-08:00</published><updated>2015-02-24T04:10:57.913-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Einstein Puzzles"/><title type='text'>Einstein Soccer Puzzle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://t1.ftcdn.net/jpg/00/31/31/98/400_F_31319864_gtqNkC4C1jy7PQkUDah8PaLUKniW42lb.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://t1.ftcdn.net/jpg/00/31/31/98/400_F_31319864_gtqNkC4C1jy7PQkUDah8PaLUKniW42lb.jpg&quot; height=&quot;266&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Puzzle :&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;This puzzle is based on soccer team. There are 7 boys on a soccer team. Each boy has a different position, jersey number, and height. &lt;br /&gt;Now we need to find out each person&#39;s height, position, and number based on the below information. Try to find out the solution using the given information/hints.&lt;br /&gt;&lt;br /&gt;* Justin is the goalie&lt;br /&gt;* The right forward is #10&lt;br /&gt;* The goalie is 6&#39; 4&#39;&#39;&lt;br /&gt;* Joe is 6&#39; 1&#39;&#39;&lt;br /&gt;* Ryan is right forward&lt;br /&gt;* The person next to Ryan is #14&lt;br /&gt;* The person who is 6&#39; 4&#39;&#39; is #16&lt;br /&gt;* #10 is 5&#39; 8&#39;&#39;&lt;br /&gt;* The left forward is #15&lt;br /&gt;* Brad is right defense&lt;br /&gt;* Brendan is #20&lt;br /&gt;* Michael is 7&#39; 1&#39;&#39;&lt;br /&gt;* Miguel is #6&lt;br /&gt;* Michael is left forward&lt;br /&gt;* #42 is right defense&lt;br /&gt;* Brad is 6&#39; 2&#39;&#39;&lt;br /&gt;* #6 is center defense&lt;br /&gt;* #15 is 7&#39; 1&#39;&#39;&lt;br /&gt;* #20 is 6&#39; 7&#39;&#39;&lt;br /&gt;* Miguel is 5&#39; 10&#39;&#39;&lt;br /&gt;* #14 is 6&#39; 1&#39;&#39;&lt;br /&gt;* The person who is 6&#39; 7&#39;&#39; is left defense&lt;br /&gt;* Joe is center forward&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Solution:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Joe: center forward, 6&#39; 1&quot;, #14&lt;br /&gt;&lt;br /&gt;Justin: goalie, 6&#39; 4&quot;, #16&lt;br /&gt;&lt;br /&gt;Michael: left forward, 7&#39; 1&quot;, #15&lt;br /&gt;&lt;br /&gt;Brendan: left defense, 6&#39; 7&quot;, #20&lt;br /&gt;&lt;br /&gt;Ryan: right forward, 5&#39; 8&quot; , #10&lt;br /&gt;&lt;br /&gt;Brad: right defense, 6&#39; 2&quot;, #42&lt;br /&gt;&lt;br /&gt;Miguel: center defense, 5&#39; 10&quot;, #6&lt;br /&gt;&lt;br /&gt;If you have another solution, please write as comment .&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/6172775628401255871'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/6172775628401255871'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2015/02/einstein-soccer-puzzle.html' title='Einstein Soccer Puzzle'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-866628990533969016</id><published>2013-08-05T09:53:00.002-07:00</published><updated>2013-08-05T09:57:33.926-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Induction Puzzles"/><category scheme="http://www.blogger.com/atom/ns#" term="Interview Puzzle"/><title type='text'>3 switches 1 light puzzle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-9OAAMMcO5JA/Uf_X5GKZFgI/AAAAAAAAAbc/wNivugpIq6I/s1600/light+bulb.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;light bulb&quot; border=&quot;0&quot; height=&quot;320&quot; src=&quot;http://1.bp.blogspot.com/-9OAAMMcO5JA/Uf_X5GKZFgI/AAAAAAAAAbc/wNivugpIq6I/s320/light+bulb.jpg&quot; title=&quot;light bulb&quot; width=&quot;299&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-bscGKBi4SG0/Uf_YG3dbVPI/AAAAAAAAAbk/6F8L3JCsBcA/s1600/3+switches.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;3 switches&quot; border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/-bscGKBi4SG0/Uf_YG3dbVPI/AAAAAAAAAbk/6F8L3JCsBcA/s1600/3+switches.jpg&quot; title=&quot;3 switches&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;You have a set of 3 light switches outside a closed door. One of them controls the light inside the room. With the door closed from outside the room, you can turn the light switches on or off as many times as you would like.&lt;br /&gt;&lt;br /&gt;You can go into the room - one time only - to see the light. You cannot see the whether the light is on or off from outside the room, nor can you change the light switches while inside the room.&lt;br /&gt;&lt;br /&gt;No one else is in the room to help you. The room has no windows.&lt;br /&gt;&lt;br /&gt;Based on the information above, how would you determine which of the three light switches controls the light inside the room?&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/866628990533969016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/866628990533969016'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2013/08/3-switches-1-light-puzzle.html' title='3 switches 1 light puzzle'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-9OAAMMcO5JA/Uf_X5GKZFgI/AAAAAAAAAbc/wNivugpIq6I/s72-c/light+bulb.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-322661743631459104</id><published>2013-07-20T07:04:00.001-07:00</published><updated>2013-07-20T07:04:23.708-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Induction Puzzles"/><category scheme="http://www.blogger.com/atom/ns#" term="Interview Puzzle"/><title type='text'>Five Pirates splitting 100 coins puzzle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-_RBx7Ba01kE/UeqXdbR15NI/AAAAAAAAAa8/efTYT18Zf7s/s1600/five+pirates.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;five pirates&quot; border=&quot;0&quot; height=&quot;224&quot; src=&quot;http://1.bp.blogspot.com/-_RBx7Ba01kE/UeqXdbR15NI/AAAAAAAAAa8/efTYT18Zf7s/s400/five+pirates.jpg&quot; title=&quot;five pirates&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;u&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Puzzle :&lt;/span&gt;&lt;/b&gt;&lt;/u&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;color: black; float: left; padding: 4px 18px 4px 4px;&quot;&gt;&lt;img alt=&quot;5 Pirates&quot; height=&quot;88&quot; src=&quot;http://www.mathsisfun.com/puzzles/images/pirates.gif&quot; style=&quot;border-style: none;&quot; width=&quot;120&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;color: black; font: 300 15px/20px Verdana,Georgia,helvetica,serif;&quot;&gt;5 pirates of different ages have a treasure of 100 gold coins. &lt;br /&gt;&lt;br /&gt;On their ship, they decide to split the coins using this scheme: &lt;br /&gt;&lt;br /&gt;The oldest pirate proposes how to share the coins, and ALL pirates (including the oldest) vote for or against it. &lt;br /&gt;&lt;br /&gt;If 50% or more of the pirates vote for it, then the coins will be shared  that way. Otherwise, the pirate proposing the scheme will be thrown  overboard, and the process is repeated with the pirates that remain.&lt;br /&gt;&lt;br /&gt;As pirates tend to be a bloodthirsty bunch, if a pirate would get the  same number of coins if he voted for or against a proposal, he will vote  against so that the pirate who proposed the plan will be thrown  overboard.&lt;br /&gt;&lt;br /&gt;Assuming that all 5 pirates are intelligent, rational, greedy, and do  not wish to die, (and are rather good at math for pirates) what will  happen?&lt;/div&gt;&lt;div style=&quot;color: black; font: 300 15px/20px Verdana,Georgia,helvetica,serif;&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;color: black; font: 300 15px/20px Verdana,Georgia,helvetica,serif;&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;color: black; font: 300 15px/20px Verdana,Georgia,helvetica,serif;&quot;&gt;&lt;b&gt;Answer :&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: black; font: 300 15px/20px Verdana,Georgia,helvetica,serif;&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;color: black; font: 300 15px/20px Verdana,Georgia,helvetica,serif;&quot;&gt;To understand the answer,&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;color: black; font: 300 15px/20px Verdana,Georgia,helvetica,serif;&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;color: black; font: 300 15px/20px Verdana,Georgia,helvetica,serif;&quot;&gt;we need to reduce this problem to only 2  pirates. So what happens if there are only 2 pirates. Pirate 2 can  easily propose that he gets all the 100 gold coins. Since he constitutes  50% of the pirates, the proposal has to be accepted leaving Pirate 1  with nothing.&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;color: black; font: 300 15px/20px Verdana,Georgia,helvetica,serif;&quot;&gt;&lt;br /&gt;Now let’s look at 3 pirates situation, Pirate 3 knows that if his  proposal does not get accepted, then pirate 2 will get all the gold and  pirate 1 will get nothing. So he decides to bribe pirate 1 with one gold  coin. Pirate 1 knows that one gold coin is better than nothing so he  has to back pirate 3. Pirate 3 proposes {pirate 1, pirate 2, pirate 3}  {1, 0, 99}. Since pirate 1 and 3 will vote for it, it will be accepted.&lt;br /&gt;&lt;br /&gt; If there are 4 pirates, pirate 4 needs to get one more pirate to vote  for his proposal. Pirate 4 realizes that if he dies, pirate 2 will get  nothing (according to the proposal with 3 pirates) so he can easily  bribe pirate 2 with one gold coin to get his vote. So the distribution  will be {0, 1, 0, 99}.&lt;br /&gt;&lt;br /&gt; Smart right? Now can you figure out the distribution with 5 pirates?  Let’s see. Pirate 5 needs 2 votes and he knows that if he dies, pirate 1  and 3 will get nothing. He can easily bribe pirates 1 and 3 with one  gold coin each to get their vote. In the end, he proposes {1, 0, 1, 0,  98}. This proposal will get accepted and provide the maximum amount of  gold to pirate 5.&lt;br /&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;color: black; font: 300 15px/20px Verdana,Georgia,helvetica,serif;&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;color: black; font: 300 15px/20px Verdana,Georgia,helvetica,serif;&quot;&gt;&lt;strong&gt;Bonus:&lt;/strong&gt; Think about what would happen if there are 15 pirates or 25 pirates. Post the answer in the comments section.&lt;/div&gt;&lt;div style=&quot;color: #000088; font: 300 15px/20px Verdana,Georgia,helvetica,serif;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/322661743631459104'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/322661743631459104'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2013/07/five-pirates-splitting-100-coins-puzzle.html' title='Five Pirates splitting 100 coins puzzle'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-_RBx7Ba01kE/UeqXdbR15NI/AAAAAAAAAa8/efTYT18Zf7s/s72-c/five+pirates.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-2808243382778844702</id><published>2013-07-15T04:00:00.003-07:00</published><updated>2013-07-15T04:02:06.718-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SoapUI"/><title type='text'>Set value in SOAPUI using Groovy Script</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SoapUI is used to test Web Services. For large number test cases, automation we can use Groovy script to reduce manual effort. Using Java, Groovy we can all manual task as automated in SoapUI.         To create data driven framework or automating test cases we can use Groovy script.&lt;br /&gt;&lt;br /&gt;The &quot;&lt;a href=&quot;http://www.techinterviewpuzzles.com/2013/07/how-to-use-properties-in-soapui.html&quot; target=&quot;_blank&quot;&gt;How to use properties&lt;/a&gt;&quot; article has how read/write/remove properties values using Groovy script.         The article &quot;&quot; has how change/update the request XML for both RESTful as well as SOAP services.&lt;br /&gt;&lt;br /&gt;The article &quot;&lt;a href=&quot;http://www.techinterviewpuzzles.com/2013/07/soapui-setread-request-header-values.html&quot; target=&quot;_blank&quot;&gt;SoapUI Set/Read Request Header values using Groovy Script&lt;/a&gt;&quot; has how to read/write HTTP method header values in both RESTful and SOAP Services.&lt;br /&gt;&lt;br /&gt;This article has how to set/read the following values.&lt;br /&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Endpoint&amp;nbsp;&lt;/li&gt;&lt;li&gt;Username&amp;nbsp;&lt;/li&gt;&lt;li&gt;Password&amp;nbsp;&lt;/li&gt;&lt;li&gt;Domain&amp;nbsp;&lt;/li&gt;&lt;li&gt;Accept type [ Applicable for POST/PUT Request in RESTFul web service only ]&amp;nbsp;&lt;/li&gt;&lt;li&gt;Media type [ Applicable for POST/PUT Request in RESTFul web service only ]&amp;nbsp;&lt;/li&gt;&lt;li&gt;Step property&amp;nbsp;&lt;/li&gt;&lt;li&gt;Request&amp;nbsp;&lt;/li&gt;&lt;li&gt;Response [ We can able to read it ]&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-uZSGPqByRcU/UePWkDLWMZI/AAAAAAAAAaU/kUFBGnRqK3s/s1600/Read+write+property.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Read write property&quot; border=&quot;0&quot; height=&quot;121&quot; src=&quot;http://4.bp.blogspot.com/-uZSGPqByRcU/UePWkDLWMZI/AAAAAAAAAaU/kUFBGnRqK3s/s400/Read+write+property.png&quot; title=&quot;Read write property&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Assign/Set values using Groovy Script.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;        &lt;br /&gt;     testRunner.testCase.testSteps[&quot;stepname&quot;].httpRequest.setEndpoint(&quot;value&quot;);&lt;br /&gt;     testRunner.testCase.testSteps[&quot;stepname&quot;].httpRequest.setUsername(&quot;value&quot;);&lt;br /&gt;     testRunner.testCase.testSteps[&quot;stepname&quot;].httpRequest.setPassword(&quot;value&quot;);&lt;br /&gt;     testRunner.testCase.testSteps[&quot;stepname&quot;].httpRequest.setDomain(&quot;value&quot;);&lt;br /&gt;     testRunner.testCase.testSteps[&quot;stepname&quot;].httpRequest.setAccept(&quot;value&quot;);&lt;br /&gt;     testRunner.testCase.testSteps[&quot;stepname&quot;].httpRequest.setMediaType(&quot;value&quot;);&lt;br /&gt;     testRunner.testCase.testSteps[&quot;stepname&quot;].setPropertyValue(&quot;name&quot;,&quot;value&quot;);&lt;br /&gt;     testRunner.testCase.testSteps[&quot;stepname&quot;].setPropertyValue(&quot;Request&quot;,&quot;value&quot;);&lt;br /&gt;&lt;/pre&gt;The article &quot;&quot; has details about how set request data with parametrization.             Read values using Groovy Script.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;        &lt;br /&gt; def strVar = testRunner.testCase.testSteps[&quot;stepname&quot;].getHttpRequest().getEndpoint();&lt;br /&gt; log.info strVar&lt;br /&gt; strVar = testRunner.testCase.testSteps[&quot;stepname&quot;].getHttpRequest().getEndpoint();&lt;br /&gt; log.info strVar&lt;br /&gt; strVar = testRunner.testCase.testSteps[&quot;stepname&quot;].getHttpRequest().getUsername();&lt;br /&gt; log.info strVar&lt;br /&gt; strVar = testRunner.testCase.testSteps[&quot;stepname&quot;].getHttpRequest().getPassword();&lt;br /&gt; log.info strVar&lt;br /&gt; strVar = testRunner.testCase.testSteps[&quot;stepname&quot;].getHttpRequest().getDomain();&lt;br /&gt; log.info strVar&lt;br /&gt; strVar = testRunner.testCase.testSteps[&quot;stepname&quot;].getPropertyValue(&quot;Request&quot;);&lt;br /&gt; log.info strVar&lt;br /&gt; strVar = testRunner.testCase.testSteps[&quot;stepname&quot;].getPropertyValue(&quot;Response&quot;);&lt;br /&gt; log.info strVar&lt;br /&gt; &lt;br /&gt; // Applicable for POST/PUT Request in RESTFul web service only&lt;br /&gt; strVar = testRunner.testCase.testSteps[&quot;stepname&quot;].getHttpRequest().getAccept();&lt;br /&gt; log.info strVar&lt;br /&gt; strVar = testRunner.testCase.testSteps[&quot;stepname&quot;].getHttpRequest().getMediaType();&lt;br /&gt; log.info strVar  &lt;br /&gt;&lt;/pre&gt;Single script to update the details of all testSteps in a test case.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;  testRunner.testCase.testSteps.each&lt;br /&gt;  {&lt;br /&gt;   q-&amp;gt;&lt;br /&gt;   if(q.getValue().config.type.equals(&quot;restrequest&quot;) || q.getValue().config.type.equals(&quot;request&quot;))&lt;br /&gt;   {&lt;br /&gt;    q.getValue().httpRequest.setEndpoint(&quot;value&quot;);&lt;br /&gt;    q.getValue().httpRequest.setUsername(&quot;value&quot;);&lt;br /&gt;    q.getValue().httpRequest.setPassword(&quot;value&quot;);&lt;br /&gt;    q.getValue().httpRequest.setDomain(&quot;value&quot;);&lt;br /&gt;   }&lt;br /&gt;   if(q.getValue().config.type.equals(&quot;restrequest&quot;))&lt;br /&gt;   {&lt;br /&gt;    q.getValue().httpRequest.setAccept(&quot;value&quot;);&lt;br /&gt;    q.getValue().httpRequest.setMediaType(&quot;value&quot;);&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;  &lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/2808243382778844702'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/2808243382778844702'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2013/07/set-value-in-soapui-using-groovy-script.html' title='Set value in SOAPUI using Groovy Script'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-uZSGPqByRcU/UePWkDLWMZI/AAAAAAAAAaU/kUFBGnRqK3s/s72-c/Read+write+property.png" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-8956316838198124630</id><published>2013-07-15T03:49:00.002-07:00</published><updated>2013-07-15T04:04:08.306-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SoapUI"/><title type='text'>SoapUI Set/Read Request Header values using Groovy Script</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;The article &quot;&lt;a href=&quot;http://www.techinterviewpuzzles.com/2013/07/read-response-headers-in-soapui-using.html&quot; target=&quot;_blank&quot;&gt;Read Response Headers in SoapUI using Groovy Script&lt;/a&gt;&quot; has how read response header values using Groovy Script. Similarly we can read/write request header values using the below Groovy script. This can be more useful for automating the SoapUI test cases.         The below script assertion can be used to read the request header values.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt; def header = messageExchange.getRequestHeaders()&lt;br /&gt; header.each&lt;br /&gt; {&lt;br /&gt;  key,val -&amp;gt;&lt;br /&gt;  log.info &quot;Key = &quot;+key+&quot; ; value=&quot;+val&lt;br /&gt; }&lt;br /&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-xoUFNlD7yPs/UePTj8lWCnI/AAAAAAAAAaI/ahl55GB5ENI/s1600/Read+Headers.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/-xoUFNlD7yPs/UePTj8lWCnI/AAAAAAAAAaI/ahl55GB5ENI/s1600/Read+Headers.png&quot; /&gt;&lt;/a&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-mP81X_ii0Qo/UePXEpQUsSI/AAAAAAAAAac/yVd8YU2civ0/s1600/Read+Headers.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Read Headers&quot; border=&quot;0&quot; height=&quot;347&quot; src=&quot;http://2.bp.blogspot.com/-mP81X_ii0Qo/UePXEpQUsSI/AAAAAAAAAac/yVd8YU2civ0/s400/Read+Headers.png&quot; title=&quot;Read Headers&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Read header values from Groovy Script test step.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt; def header = testRunner.testCase.testSteps[&quot;add&quot;].httpRequest.getRequestHeaders()&lt;br /&gt; header.each&lt;br /&gt; {&lt;br /&gt;  key,val -&amp;gt;&lt;br /&gt;  log.info &quot;Key = &quot;+key+&quot; ; value=&quot;+val&lt;br /&gt; }&lt;br /&gt; &lt;/pre&gt;The below Groovy Script can be used to set the request header values.        &lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt; import com.eviware.soapui.support.types.StringToStringMap &lt;br /&gt; def headers = new StringToStringMap()&lt;br /&gt; headers.put(&quot;name&quot;,&quot;value&quot;);&lt;br /&gt; headers.put(&quot;name1&quot;,&quot;value1&quot;)&lt;br /&gt; headers.put(&quot;name2&quot;,&quot;value2&quot;)&lt;br /&gt; testRunner.testCase.testSteps[&quot;add&quot;].getHttpRequest().setRequestHeaders(headers)&lt;br /&gt; &lt;/pre&gt;The below Groovy Script can be used to update the request header values.        &lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt; import com.eviware.soapui.support.types.StringToStringMap &lt;br /&gt; def headers = testRunner.testCase.testSteps[&quot;add&quot;].getHttpRequest().getRequestHeaders()&lt;br /&gt; def list = []&lt;br /&gt; list.add(&quot;newvalue&quot;)&lt;br /&gt; headers[&quot;name1&quot;] = list;&lt;br /&gt; testRunner.testCase.testSteps[&quot;add&quot;].getHttpRequest().setRequestHeaders(headers)&lt;br /&gt;   &lt;/pre&gt;&lt;b&gt;Reference&lt;/b&gt; :&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.soapui.org/SOAP-and-WSDL/adding-headers-and-attachments.html#1-custom-http-headers&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;http://www.soapui.org/SOAP-and-WSDL/adding-headers-and-attachments.html#1-custom-http-headers&lt;/a&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/8956316838198124630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/8956316838198124630'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2013/07/soapui-setread-request-header-values.html' title='SoapUI Set/Read Request Header values using Groovy Script'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-xoUFNlD7yPs/UePTj8lWCnI/AAAAAAAAAaI/ahl55GB5ENI/s72-c/Read+Headers.png" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-5868474242571360524</id><published>2013-07-15T03:24:00.000-07:00</published><updated>2013-07-15T03:24:01.579-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Automation Testing"/><category scheme="http://www.blogger.com/atom/ns#" term="SoapUI"/><title type='text'>SoapUI add header to all requests using Groovy Script.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;Using the below code snippet or Groovy Script we can add headers to all the request in a test case.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt; import com.eviware.soapui.support.types.StringToStringMap &lt;br /&gt; def headers = new StringToStringMap()&lt;br /&gt; headers.put(&quot;name&quot;,&quot;value&quot;);&lt;br /&gt; headers.put(&quot;name1&quot;,&quot;value1&quot;)&lt;br /&gt; headers.put(&quot;name2&quot;,&quot;value2&quot;)&lt;br /&gt; testRunner.testCase.testSteps.each&lt;br /&gt; {&lt;br /&gt;  q-&amp;gt;&lt;br /&gt;  if(q.getValue().config.type.equals(&quot;restrequest&quot;) || q.getValue().config.type.equals(&quot;request&quot;))&lt;br /&gt;  {&lt;br /&gt;   q.getValue().getHttpRequest().setRequestHeaders(headers)&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt; &lt;/pre&gt;For more details on how to add/update header using Groovy Script, please refer this article.    Groovy script to update the header value in all steps in a test suite.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt; import com.eviware.soapui.impl.wsdl.teststeps.*&lt;br /&gt; import com.eviware.soapui.support.types.StringToStringsMap&lt;br /&gt;&lt;br /&gt; for( testCase in testSuite.getTestCaseList() ) {&lt;br /&gt;    for( testStep in testCase.getTestStepList() ) {&lt;br /&gt;    if( testStep instanceof WsdlTestRequestStep ) {&lt;br /&gt;    def headers = new StringToStringsMap()&lt;br /&gt;    headers.put(testSuite.getPropertyValue(&quot;ExampleHeaderName&quot;),testSuite.getPropertyValue(&quot;ExampleHeaderValue&quot;))&lt;br /&gt;&lt;br /&gt;    log.info(&quot;Setting HTTP headers ${headers} in test case ${testCase.getLabel()}&quot;)&lt;br /&gt;    testStep.getTestRequest().setRequestHeaders(headers)&lt;br /&gt;    }&lt;br /&gt;    }&lt;br /&gt; &lt;/pre&gt;Just set the properties ExampleHeaderName and ExampleHeaderValue for your TestSuite and use the script as &quot;Setup Script&quot; of the TestSuite.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Reference :&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href=&quot;http://www.soapui.org/forum/viewtopic.php?t=3746&quot;&gt;http://www.soapui.org/forum/viewtopic.php?t=3746&lt;/a&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href=&quot;https://thewonggei.wordpress.com/2010/08/05/configure-http-basic-auth-once-for-soapui-test-suties/&quot;&gt;https://thewonggei.wordpress.com/2010/08/05/configure-http-basic-auth-once-for-soapui-test-suties/&lt;/a&gt;  &lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/5868474242571360524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/5868474242571360524'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2013/07/soapui-add-header-to-all-requests-using.html' title='SoapUI add header to all requests using Groovy Script.'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-7999825713682431722</id><published>2013-07-12T05:44:00.001-07:00</published><updated>2013-07-15T04:33:17.994-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Interview Puzzle"/><category scheme="http://www.blogger.com/atom/ns#" term="Lateral Thinking Puzzles"/><title type='text'>Three mislabeled jars problem</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-EyjTnHAkU5U/Ud_5iuorszI/AAAAAAAAAZ0/gXni3irhyIE/s1600/Three+mislabeled+jars+problem.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Three mislabeled jars problem&quot; border=&quot;0&quot; height=&quot;202&quot; src=&quot;http://2.bp.blogspot.com/-EyjTnHAkU5U/Ud_5iuorszI/AAAAAAAAAZ0/gXni3irhyIE/s400/Three+mislabeled+jars+problem.jpg&quot; title=&quot;Three mislabeled jars problem&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;Puzzle : &lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;This problem is also called Jelly Beans problem. You have three jars that are all mislabeled. one contains apples, another has grapes, and the third has a mix of both.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;Now you are allowed to open any one jar and you can able to see one fruit. [ The jar you are open may contain one fruit or two fruit. but you could able to see only one fruit and you can&#39;t find weather the opened jar has one or two fruit].&amp;nbsp; How could you fix the labels on the jars ?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Variation : &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-0XYaM8kdpGE/UePd6w7UPDI/AAAAAAAAAas/LPk3j_DF2Vs/s1600/Jelly-Beans-shutterstock.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;JellyBean&quot; border=&quot;0&quot; height=&quot;250&quot; src=&quot;http://2.bp.blogspot.com/-0XYaM8kdpGE/UePd6w7UPDI/AAAAAAAAAas/LPk3j_DF2Vs/s400/Jelly-Beans-shutterstock.jpg&quot; title=&quot;JellyBean&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;You have three jars that are all mislabeled. one contains peanut  butter jelly beans, another grape jelly jelly beans, and the third has a  mix of both (not necessarily a 50/50 mix, could be a 1/99 mix or a  399/22 mix). how many jelly beans would you have to pull out, and out of  which jars, to find out how to fix the labels on the jars?&lt;br /&gt;&lt;pre&gt;|     |        |     |          |     |&lt;br /&gt;|jar 1|        |jar 2|          |jar 3|&lt;br /&gt;|     |        |     |          |     |&lt;br /&gt;=======        =======          =======&lt;br /&gt;  p.b.          grape          p.b./grape&lt;/pre&gt;thanks to joel wollman&lt;br /&gt;&lt;br /&gt;Answer :&lt;br /&gt;&lt;br /&gt;&amp;nbsp;1. Need to open Apple+Orange jar. If it has apple. then it should be labeled as Apple. The jar which has label Orange should be labeled as &quot;Apple+Orange&quot; and the last one should be &quot;Orange&quot;.&lt;br /&gt;&lt;br /&gt;2. You have three jars that are all mislabeled. one contains peanut  butter jelly beans, another grape jelly jelly beans, and the third has a  mix of both (not necessarily a 50/50 mix, could be a 1/99 mix or a  399/22 mix). how many jelly beans would you have to pull out, and out of  which jars, to find out how to fix the labels on the jars?&lt;br /&gt;&lt;pre&gt;   |     |                  |     |                 |     |&lt;br /&gt;  |jar 1|                |jar 2|               |jar 3|&lt;br /&gt;   |     |                  |     |                 |     |&lt;br /&gt;=======        =======          =======&lt;br /&gt;     p.b.                   grape             p.b./grape&lt;/pre&gt;solution: 1 jelly bean from the p.b./grape jar will do the trick.&lt;br /&gt;the trick here is to realize that every jar is mislabeled. therefore  you know that the peanut butter jelly bean jar is not the penut butter  jelly bean jar, and the same goes for the rest.&lt;br /&gt;you also need to realize that it is the jar labeled p.b./grape,  labelled as the mix jar, that is your best hope. if you choose a jelly  bean out of there, then you will know whether that jar is peanut butter  or grape jelly jelly beans. it can’t be the mix jar because i already  said that every jar is mislabeled.&lt;br /&gt;once you know that jar 3 is either peanut butter, or grape jelly,  then you know the other jars also. if it is peanut butter, then jar 2  must be mixed because it can’t be grape (as its labelled) and it can’t  be peanut butter (that’s jar 3). hence jar 1 is grape.&lt;br /&gt;if jar 3 is grape, then you know jar 1 must be the mix because it  can’t be p.b. (as its labelled) and it can’t be grape (that’s jar 3).  hence jar 2 is peanut butter.&lt;br /&gt;if you pick jelly beans from jar 1 or jar 2, then you would have to pick out &lt;b&gt;all&lt;/b&gt; of the jelly beans before you knew what that jar was. this is because  jar 1 and 2 could be the mix, so in order to disprove that they were the  mix, you would have to pull out &lt;b&gt;every&lt;/b&gt; jelly bean just to make sure (since there could just be one bean of the opposite flavor in there)&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/7999825713682431722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/7999825713682431722'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2013/07/three-mislabeled-jars-problem.html' title='Three mislabeled jars problem'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-EyjTnHAkU5U/Ud_5iuorszI/AAAAAAAAAZ0/gXni3irhyIE/s72-c/Three+mislabeled+jars+problem.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-651663978170128467</id><published>2013-07-10T23:53:00.000-07:00</published><updated>2013-07-10T23:54:10.169-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Automation Testing"/><category scheme="http://www.blogger.com/atom/ns#" term="SoapUI"/><title type='text'>Read Response Headers in SoapUI using Groovy Script</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;SoapUI is one of the Web service testing tool. Many times we have scenarios to validate the headers values in the response weather it might be RESTful service or SOAP service. &lt;br /&gt;&lt;br /&gt;SoapUI has many inbuilt assertions. The assertions &quot;Valid HTTP status codes&quot; and &quot;Invalid HTTP status codes&quot; can be used validate the response status code. Which is shown in the below screen.&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-123c2NFh7sQ/Ud5V4uDQTgI/AAAAAAAAAZY/nVQMWbCZ-RQ/s1600/status_code_assertions.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;response status code&quot; border=&quot;0&quot; height=&quot;308&quot; src=&quot;http://3.bp.blogspot.com/-123c2NFh7sQ/Ud5V4uDQTgI/AAAAAAAAAZY/nVQMWbCZ-RQ/s400/status_code_assertions.png&quot; title=&quot;response status code&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;But the tool doesn&#39;t have any inbuilt assertions to get any specific response header value to validate it. We can do this using Groovy script in SoapUI.&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-xClR8GgzuAM/Ud5WAq4BRfI/AAAAAAAAAZg/Wzkh97RSgl4/s1600/Read+Response+Headers.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;groovy script we can read any specific header value&quot; border=&quot;0&quot; height=&quot;427&quot; src=&quot;http://1.bp.blogspot.com/-xClR8GgzuAM/Ud5WAq4BRfI/AAAAAAAAAZg/Wzkh97RSgl4/s640/Read+Response+Headers.png&quot; title=&quot;groovy script we can read any specific header value&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;From the above image, the response has seven headers values including status code. Using the below groovy script we can read any specific header value.&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;def val = messageExchange.getResponseHeaders()[&quot;Content-Type&quot;][0]&lt;br /&gt;log.info val&lt;br /&gt;assert val == &quot;text/xml; charset=UTF-8&quot; : &quot;Content type not valid&quot;&lt;br /&gt;&lt;/pre&gt;The above Groovy Script can be used in &quot;Script Assertion&quot; to read and validate the response content type as &quot;text/xml&quot;. If we need to read the Response headers value from &quot;Groovy script&quot; test step then we can use the below script.&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;def val = testRunner.testCase.testSteps[&#39;add&#39;].testRequest.response.getResponseHeaders()[&quot;Content-Type&quot;][0]&lt;br /&gt;log.info val&lt;br /&gt;assert val == &quot;text/xml; charset=UTF-8&quot; : &quot;Content type not valid&quot;&lt;br /&gt;&lt;/pre&gt;The below code snippet can be used to read all Header values from the response using groovy script.&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;def val = messageExchange.getResponseHeaders()&lt;br /&gt;val.each&lt;br /&gt;{&lt;br /&gt;    k,v -&amp;gt;&lt;br /&gt;    log.info &quot;name =&quot;+k+&quot;, value = &quot;+v&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/651663978170128467'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/651663978170128467'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2013/07/read-response-headers-in-soapui-using.html' title='Read Response Headers in SoapUI using Groovy Script'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-123c2NFh7sQ/Ud5V4uDQTgI/AAAAAAAAAZY/nVQMWbCZ-RQ/s72-c/status_code_assertions.png" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-7171207757177530083</id><published>2013-07-10T08:41:00.001-07:00</published><updated>2013-07-10T08:53:53.662-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Automation Testing"/><category scheme="http://www.blogger.com/atom/ns#" term="SoapUI"/><title type='text'>How to use properties in soapui</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&amp;nbsp; &lt;br /&gt;&lt;b&gt;What is properties in SoapUI ?&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Properties in SoapUI is used to store and retrieve data. The data is stored as key,value format.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Default properties in SoapUI.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SoapUI has properties at three levels by default.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.&amp;nbsp;&amp;nbsp;&amp;nbsp; Project level default/custom properties.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; User can add any number properties at project level and this can be accessed from any test steps from any test cases under any test suites.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2. Test suite level default/custom properties.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; User can add any number properties at test suite level and this can be accessed from any test steps from any test cases under this test suite.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3. Test Case level default/custom properties.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; User can add any number properties at test case level and this can be accessed from any test steps from this test case.&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-LKVvn11ds54/Ud2BgwoAMyI/AAAAAAAAAYw/dE-W68pEKSI/s1600/default+properties.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;SoapUI Properties&quot; border=&quot;0&quot; height=&quot;361&quot; src=&quot;http://3.bp.blogspot.com/-LKVvn11ds54/Ud2BgwoAMyI/AAAAAAAAAYw/dE-W68pEKSI/s400/default+properties.png&quot; title=&quot;SoapUI Properties&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;Where to use properties in SoapUI&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; We can read the property values into test step endpoint, Header values, username, password, domain, GET, POST, PUT and DELETE method properties.&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-CWS7ctCn-4g/Ud2Bfx9w_pI/AAAAAAAAAYo/q7N2tt3GYrQ/s1600/Header+properties.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Header properties&quot; border=&quot;0&quot; height=&quot;206&quot; src=&quot;http://2.bp.blogspot.com/-CWS7ctCn-4g/Ud2Bfx9w_pI/AAAAAAAAAYo/q7N2tt3GYrQ/s400/Header+properties.png&quot; title=&quot;Header properties&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The above image shows how to use the properties in Header or inside the Post request. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to use default/custom properties.&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The default/custom values at three levels can be used for endpoint, Header values, username, password etc.. &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The general format for reading the default/custom property value is &amp;nbsp;&amp;nbsp;&amp;nbsp; :&amp;nbsp;&amp;nbsp;&amp;nbsp; ${#levelname#key}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ex :&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; To read test case level property&amp;nbsp;&amp;nbsp;&amp;nbsp; :&amp;nbsp;&amp;nbsp;&amp;nbsp; ${#TestCase#param1}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; To read test suite level property&amp;nbsp;&amp;nbsp;&amp;nbsp; :&amp;nbsp;&amp;nbsp;&amp;nbsp; ${#TestSuite#param1}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; To read&amp;nbsp; project level property&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; :&amp;nbsp;&amp;nbsp;&amp;nbsp; ${#Project#param1}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The above image shows how to use the property at test case level.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Read property using Groovy Script&amp;nbsp;&lt;/b&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Reading property values from a script is straight-forward, to get a property value you first need to get hold of the containing object and then use the getPropertyValue(&quot;property name&quot;) method.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Groovy script can be used in two places inside the SoapUI.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 1.&amp;nbsp;&amp;nbsp;&amp;nbsp; Groovy script test step&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 2.&amp;nbsp;&amp;nbsp;&amp;nbsp; Script Assertion - within test step.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The below code snippet can be used to read test case level property from Groovy script test step.&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;def param1 = context.testCase.getPropertyValue( &quot;param1&quot; )&lt;br /&gt;log.info param1&lt;br /&gt;&lt;/pre&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/--ZSKhn1ipAs/Ud2Bgs-uhOI/AAAAAAAAAY8/v9ay0uWYGEU/s1600/Read+Property.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Read property&quot; border=&quot;0&quot; height=&quot;203&quot; src=&quot;http://3.bp.blogspot.com/--ZSKhn1ipAs/Ud2Bgs-uhOI/AAAAAAAAAY8/v9ay0uWYGEU/s400/Read+Property.png&quot; title=&quot;Read property&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Similarly the below code snippet can be used to read test case level property from Script Assertion.&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;def param1 = testRunner.testCase.getPropertyValue( &quot;param1&quot; )&lt;br /&gt;log.info param1&lt;br /&gt;&lt;/pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-GUbnHLrlNBs/Ud2Bf0rohoI/AAAAAAAAAYs/0z4TR_sYDpQ/s1600/Read+Property+Groovy.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Read property using script&quot; border=&quot;0&quot; height=&quot;218&quot; src=&quot;http://2.bp.blogspot.com/-GUbnHLrlNBs/Ud2Bf0rohoI/AAAAAAAAAYs/0z4TR_sYDpQ/s400/Read+Property+Groovy.png&quot; title=&quot;Read property using script&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; We can read the property value from test suite level as well as project level in similar way.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Code snippet to read test suite level property&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;def param1 = testRunner.testCase.testSuite.getPropertyValue( &quot;param1&quot; )&lt;br /&gt;log.info param1&lt;br /&gt;&lt;/pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Code snippet to read project level property&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;def param1 = testRunner.testCase.testSuite.project.getPropertyValue( &quot;param1&quot; )&lt;br /&gt;log.info param1&lt;br /&gt;&lt;/pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;b&gt;Set/Add property using Groovy Script&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; As like reading property value, writing property values from a script is also straight-forward. we need to call setPropertyValue(&quot;property name&quot;,&quot;property value&quot;) method. If the property is not exist already then it will be created and the value will be assigned. If the property is already exist then its value will be updated.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Code snippet to write test case level property&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;&lt;br /&gt;context.testCase.setPropertyValue( &quot;param1&quot;,&quot;88&quot; );&lt;br /&gt;&lt;/pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Similarly the code snippet to write values for testsuite and project level property are&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;context.testCase.testSuite.setPropertyValue( &quot;param1&quot;,&quot;88&quot; );&lt;br /&gt;context.testCase.testSuite.project.setPropertyValue( &quot;param1&quot;,&quot;88&quot; );&lt;br /&gt;&lt;/pre&gt;&lt;b&gt;Delete property using Groovy Script&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; We can manually add any number of default or custom properties at all three levels. But the tool doesn&#39;t have the option to delete the properties manually. we need to use the script to delete the property.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;a href=&quot;http://1.bp.blogspot.com/-C_RN3lb_Tws/Ud2Bf2HbjMI/AAAAAAAAAYg/yUqPYEKXyXE/s1600/Delete+Property.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;SoapUI Delete property&quot; border=&quot;0&quot; height=&quot;400&quot; src=&quot;http://1.bp.blogspot.com/-C_RN3lb_Tws/Ud2Bf2HbjMI/AAAAAAAAAYg/yUqPYEKXyXE/s400/Delete+Property.png&quot; title=&quot;SoapUI Delete property&quot; width=&quot;373&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; using the below script we can delete the property.&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;&lt;br /&gt;context.testCase.removeProperty( &quot;param1&quot; );&lt;br /&gt;&lt;/pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; similarly we can delete the properties in testsuite and project level&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;&lt;br /&gt;context.testCase.testSuite.removeProperty( &quot;param1&quot; );&lt;br /&gt;context.testCase.testSuite.project.removeProperty( &quot;param1&quot; );&lt;br /&gt;&lt;/pre&gt;&lt;b&gt;Delete/Remove all custom properties using Groovy Script.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; The below code snippet can be used to delete all the properties available in test suite level.&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;context.testCase.properties.each&lt;br /&gt;{&lt;br /&gt;    k,v -&amp;gt;&lt;br /&gt;    context.testCase.removeProperty(k);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; we can modify the above code to delete all the properties at different levels as discussed above.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/7171207757177530083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/7171207757177530083'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2013/07/how-to-use-properties-in-soapui.html' title='How to use properties in soapui'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-LKVvn11ds54/Ud2BgwoAMyI/AAAAAAAAAYw/dE-W68pEKSI/s72-c/default+properties.png" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-3881017552113071981</id><published>2013-07-10T05:50:00.000-07:00</published><updated>2013-07-10T06:16:07.470-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Automation Testing"/><category scheme="http://www.blogger.com/atom/ns#" term="SoapUI"/><title type='text'>SoapUI - Parametrize the endpoint</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;&lt;br /&gt;SoapUI is one the most famous Web Service testing tool in today&#39;s scenario. For all GUI Testing we have several environments. Similarly we have multiple environments for Web Service Testing.&lt;br /&gt;&lt;br /&gt;Parametrize the environment is most important and could be first task in automation testing.&amp;nbsp; For that a more common scenario in a complex service environment is the need to  change the endpoint of some of the services involved in your tests, for  example between test, dev and staging environments.&lt;br /&gt;&lt;br /&gt;Manually changing  endpoints is of course possible but far too tedious when there might be  hundreds of request test steps involved, and using the command-line host  override option does not allow you to change a single service endpoint  if you have multiple ones in use.&lt;br /&gt;&lt;br /&gt;Changing the endpoint manually will take lot of time for more number of test cases. To overcome this issue SoapUI has the option called properties.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;Properties to the rescue;&lt;br /&gt;&lt;br /&gt;1.&amp;nbsp; Define a project property holding the endpoint:&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://www.soapui.org/images/stories/functionaltesting/service-endpoint-property.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;SoapUI Project&quot; border=&quot;0&quot; height=&quot;341&quot; src=&quot;http://www.soapui.org/images/stories/functionaltesting/service-endpoint-property.png&quot; title=&quot;SoapUI Project&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;2.&amp;nbsp; Configure the endpoint to use this property via property-expansion&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://www.soapui.org/images/stories/functionaltesting/service-endpoints-tab.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;SoapUI add endpoint&quot; border=&quot;0&quot; height=&quot;161&quot; src=&quot;http://www.soapui.org/images/stories/functionaltesting/service-endpoints-tab.png&quot; title=&quot;SoapUI add endpoint&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;3. Make sure your requests are using the configured endpoint&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://www.soapui.org/images/stories/functionaltesting/request-service-endpoint.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;configure endpoint&quot; border=&quot;0&quot; height=&quot;117&quot; src=&quot;http://www.soapui.org/images/stories/functionaltesting/request-service-endpoint.png&quot; title=&quot;configure endpoint&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;4. Now when you run the request, the property will automatically be  replaced with its current value. To use a different value just change  the endpoint in the UI, or from the command-line you can use the -P  option;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;courier new&#39;, courier;&quot;&gt;-PServiceEndoint=dev.smartbear.com:8884&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;which would use the dev.smartbear.com:8884 endpoint instead (entirely fictional). &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Reference :&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.soapui.org/Functional-Testing/working-with-properties.html&quot;&gt;http://www.soapui.org/Functional-Testing/working-with-properties.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/3881017552113071981'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/3881017552113071981'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2013/07/soapui-parameterizing-endpoint.html' title='SoapUI - Parametrize the endpoint'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-8979384647779825821</id><published>2012-12-29T02:44:00.000-08:00</published><updated>2013-07-01T05:44:51.783-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Feature"/><title type='text'>3 Ways to Answer “What’s Your Biggest Weakness?”</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-Ga8H-lCTB2s/UN7IEJhwpLI/AAAAAAAAAPM/gwTBg0O1PBA/s1600/greatest+weeknesses.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Biggest Weakness&quot; border=&quot;0&quot; src=&quot;http://3.bp.blogspot.com/-Ga8H-lCTB2s/UN7IEJhwpLI/AAAAAAAAAPM/gwTBg0O1PBA/s400/greatest+weeknesses.jpg&quot; height=&quot;262&quot; title=&quot;Biggest Weakness&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;h2 style=&quot;text-align: center;&quot;&gt;3 Ways to Answer “What’s Your Biggest Weakness?”&lt;/h2&gt;&lt;h2 style=&quot;text-align: center;&quot;&gt;&amp;nbsp;&lt;/h2&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;When you’re asked “what’s your greatest strength?” in an interview, you’ve got it covered: You showcase your professional skills and talk about how there’s no one better suited for the job. But, “what’s your biggest weakness?” That question can be much tougher to answer.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;span class=&quot;status&quot;&gt;Y6JWDSSM9ZM3&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;But it’s not a trick question. What your interviewer is really trying to do—beyond identifying any red flags—is to gauge your self-awareness and honesty. So, “I can’t meet a deadline to save my life” is not an option—but neither is “Nothing! I’m perfect!” A good answer can show how you can overcome challenges, paint you as a committed professional who continues to improve herself, and actually highlight your strengths.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;Here are three strategies to ensure that talking about your weakness won’t be the weak spot in your next interview.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;1. Show How You’ve Overcome Something&lt;/h3&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Everyone has areas that could use improvement, but if you can describe how you’ve mitigated yours, you’ll seem strong, capable, and in charge of your professional development. So, think of something that you struggle with but that you’re working to improve. You could explain that you’ve never been strong at public speaking, but over the past few years, you’ve asked for team leadership roles, run successfully meetings, and found tools to help you be more comfortable when addressing a crowd.&lt;br /&gt;&lt;br /&gt;Another smart tactic is to describe something that was once a weakness, but that you now can point to as an accomplishment. For example, “I’ve always had to work at math. But I took a course in Excel, and that’s helped me tackle quantitative analysis projects much more easily. In fact, let me show you a report I recently developed.”&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;2. Address Uncertainties in Your Background&lt;/h3&gt;&lt;div style=&quot;text-align: left;&quot;&gt;If your background doesn’t completely match up with the requirements in the job description, or if you know that the employer has hesitations about parts of your experience, this question is a great time to address those uncertainties.&lt;br /&gt;&lt;br /&gt;You can talk about something she already knows is a hurdle, but at the same time, turn it around to highlight your strong points. For example: “It might seem that my biggest weakness in applying for this position is that I don’t have any inside sales experience. But the skills I’ve gained during my five years of fundraising are incredibly relevant to the position—let me tell you why.”&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;3. Paint a Weakness as a Strength&lt;/h3&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Choose a shortcoming that can be explained in the most positive light possible. Are you neurotic, stubborn, or incapable of delegating? Instead, try using words that are seen as professional strengths, like dedicated, persistent, or thorough. For example: “I tend to be a perfectionist, so sometimes I have a hard time letting a project leave my hands until it’s absolutely finalized.” This answer addresses an area you need to improve, but explains it in a positive way.&lt;br /&gt;&lt;br /&gt;Just be sure to follow it up with how you’ve addressed this “shortcoming,” such as: “But I’ve found that sometimes it’s more effective to get feedback on a project along the way, even if it is not yet complete. I try to strike a balance between getting things done right the first time and being open to others’ input.”&lt;br /&gt;&lt;br /&gt;Whatever strategy you choose, the trick is to sound genuine and to end things on a positive note. Rehearse your response so that you can give it easily, and more importantly, concisely—if you spend too much time talking about your flaws, it’s easy to dig yourself into a hole. Get past the “weakness” part of your answer as quickly as possible, so you can get back what’s most important: your (many!) strengths.&lt;/div&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/8979384647779825821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/8979384647779825821'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2012/12/3-ways-to-answer-whats-your-biggest.html' title='3 Ways to Answer “What’s Your Biggest Weakness?”'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-Ga8H-lCTB2s/UN7IEJhwpLI/AAAAAAAAAPM/gwTBg0O1PBA/s72-c/greatest+weeknesses.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-7074803335031211203</id><published>2012-12-29T02:36:00.002-08:00</published><updated>2013-06-29T08:02:01.138-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Feature"/><category scheme="http://www.blogger.com/atom/ns#" term="HR Interview Questions"/><title type='text'>What are your greatest strengths and weaknesses ?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;h2 style=&quot;text-align: center;&quot;&gt;What are your greatest strengths and weaknesses ?&lt;/h2&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-RBMstZprF7c/UN7FgPEhXBI/AAAAAAAAAO8/6sWs5QFZIAM/s1600/Strengths.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;265&quot; src=&quot;http://3.bp.blogspot.com/-RBMstZprF7c/UN7FgPEhXBI/AAAAAAAAAO8/6sWs5QFZIAM/s400/Strengths.jpg&quot; width=&quot;400&quot; /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&amp;nbsp;Strengths&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&amp;nbsp;Trabs&lt;/li&gt;&lt;li&gt;&amp;nbsp;Best Answer&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Weeknesses&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Trabs&lt;/li&gt;&lt;li&gt;Possible Answer&lt;/li&gt;&lt;li&gt;Example 1 &lt;/li&gt;&lt;li&gt;Drawback&lt;/li&gt;&lt;li&gt;Example 2&lt;/li&gt;&lt;li&gt;Example 3 &lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Strengths&lt;/h3&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;b&gt;Trabs :&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;This question seems like a softball lob, but be prepared. You don&#39;t want to come across as egotistical or arrogant. Neither is this a time to be humble.&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Best Answer:&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;You know that your key strategy is to first uncover your interviewer&#39;s greatest wants and needs before you answer questions. And from Question 1, you know how to do this.&lt;/div&gt;&lt;br /&gt;Prior to any interview, you should have a list mentally prepared of your greatest strengths. You should also have, a specific example or two, which illustrates each strength, an example chosen from your most recent and most impressive achievements.&lt;br /&gt;&lt;br /&gt;You should, have this list of your greatest strengths and corresponding examples from your achievements so well committed to memory that you can recite them cold after being shaken awake at 2:30AM.&lt;br /&gt;&lt;br /&gt;Then, once you uncover your interviewer&#39;s greatest wants and needs, you can choose those achievements from your list that best match up.&lt;br /&gt;&lt;br /&gt;As a general guideline, the 10 most desirable traits that all employers love to see in their employees are:&lt;br /&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;A proven track record as an achiever...especially if your achievements match up with the employer&#39;s greatest wants and needs.&lt;/li&gt;&lt;li&gt;Intelligence...management &quot;savvy&quot;.&lt;/li&gt;&lt;li&gt;Honesty...integrity...a decent human being.&lt;/li&gt;&lt;li&gt;Good fit with corporate culture...someone to feel comfortable with...a team player who meshes well with interviewer&#39;s team.&lt;/li&gt;&lt;li&gt;Likeability...positive attitude...sense of humor.&lt;/li&gt;&lt;li&gt;Good communication skills.&lt;/li&gt;&lt;li&gt;Dedication...willingness to walk the extra mile to achieve excellence.&lt;/li&gt;&lt;li&gt;Definiteness of purpose...clear goals.&lt;/li&gt;&lt;li&gt;Enthusiasm...high level of motivation.&lt;/li&gt;&lt;li&gt;Confident...healthy...a leader.&amp;nbsp; &lt;/li&gt;&lt;/ol&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&amp;nbsp;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Weaknesses&lt;/h3&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;b&gt;Trabs:&lt;/b&gt; Beware - this is an eliminator question, designed to shorten the candidate list. Any admission of a weakness or fault will earn you an “A” for honesty, but an “F” for the interview.&lt;/div&gt;&lt;br /&gt;&lt;b&gt;PASSABLE ANSWER&lt;/b&gt;: Disguise a strength as a weakness.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Example 1:&lt;/b&gt; “I sometimes push my people too hard. I like to work with a sense of urgency and everyone is not always on the same wavelength.”&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Drawback :&lt;/b&gt; This strategy is better than admitting a flaw, but it&#39;s so widely used, it is transparent to any experienced interviewer.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BEST ANSWER:&lt;/b&gt; (and another reason it&#39;s so important to get a thorough description of your interviewer&#39;s needs before you answer questions): Assure the interviewer that you can think of nothing that would stand in the way of your performing in this position with excellence. Then, quickly review you strongest qualifications.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Example 2:&lt;/b&gt; “Nobody&#39;s perfect, but based on what you&#39;ve told me about this position, I believe I&#39; d make an outstanding match. I know that when I hire people, I look for two things most of all. Do they have the qualifications to do the job well, and the motivation to do it well? Everything in my background shows I have both the qualifications and a strong desire to achieve excellence in whatever I take on. So I can say in all honesty that I see nothing that would cause you even a small concern about my ability or my strong desire to perform this job with excellence.”&lt;br /&gt;&lt;b&gt;&lt;br /&gt;Alternate strategy :&lt;/b&gt; (if you don&#39;t yet know enough about the position to talk about such a perfect fit):&lt;br /&gt;Instead of confessing a weakness, describe what you like most and like least, making sure that what you like most matches up with the most important qualification for success in the position, and what you like least is not essential.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Example 3:&lt;/b&gt; Let&#39;s say you&#39;re applying for a teaching position. “If given a choice, I like to spend as much time as possible in front of my prospects selling, as opposed to shuffling paperwork back at the office. Of course, I long ago learned the importance of filing paperwork properly, and I do it conscientiously. But what I really love to do is sell (if your interviewer were a sales manager, this should be music to his ears.) &lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/7074803335031211203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/7074803335031211203'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2012/12/what-are-your-greatest-strengths-and.html' title='What are your greatest strengths and weaknesses ?'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-RBMstZprF7c/UN7FgPEhXBI/AAAAAAAAAO8/6sWs5QFZIAM/s72-c/Strengths.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-1867775832041781289</id><published>2012-12-29T01:31:00.001-08:00</published><updated>2013-07-01T05:44:38.620-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Feature"/><title type='text'>Tell us something about yourself</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;h2&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Tell us something about yourself &lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/h2&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-WQjGjHvd2jg/UN634Ea1xjI/AAAAAAAAAOs/3FnE7fbUS6Q/s1600/Tell-me-about-yourself.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://1.bp.blogspot.com/-WQjGjHvd2jg/UN634Ea1xjI/AAAAAAAAAOs/3FnE7fbUS6Q/s400/Tell-me-about-yourself.jpg&quot; height=&quot;400&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;a href=&quot;http://www.techinterviewpuzzles.com/2012/12/tell-us-something-about-yourself.html#Introduction&quot;&gt;Introduction&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.techinterviewpuzzles.com/2012/12/tell-us-something-about-yourself.html#Trabs&quot;&gt;Trabs&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.techinterviewpuzzles.com/2012/12/tell-us-something-about-yourself.html#Best&quot;&gt;Best Answer&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;/h3&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b id=&quot;Introduction&quot;&gt;Introduction :&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;This is the first question, you can expect during any interview you face. This usually is a question to start the communication and set the ball rolling for the interview. You can answer this question by providing some information about your work experience, technologies you have worked upon, educational qualifications. If you are a fresh graduate, you can provide some information about your family also.&lt;br /&gt;&lt;br /&gt;Since this is often the opening question in an interview, be extra careful that you don’t run off at the mouth. Keep your answer to a minute or two at most. Cover four topics: early years, education, work history, and recent career experience. Emphasize this last subject. Remember that this is likely to be a warm-up question. Don’t waste your best points on it.&lt;br /&gt;&lt;br /&gt;The trick is to put the full stop at the right place to provoke the next question you want. For e.g. “Recently I developed a website using Drupal. It was quite an interesting but challenging job which I enjoyed”&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;h3&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b id=&quot;Trabs&quot;&gt;Trabs:&lt;/b&gt;&lt;/span&gt;&lt;/h3&gt;Beware, about 80% of all interviews begin with this “innocent” question.  Many candidates, unprepared for the question, skewer themselves by  rambling, recapping their life story, delving into ancient work history  or personal matters.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b id=&quot;Best&quot;&gt;Best Answer:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Start with the present and tell why you are well qualified for the  position. Remember that the key to all successful interviewing is to  match your qualifications to what the interviewer is looking for. In  other words &lt;i&gt;you must sell what the buyer is buying. This is the single most important strategy in job hunting. &lt;/i&gt;&lt;br /&gt;&lt;br /&gt;So,  before you answer this or any question it&#39;s imperative that you try to  uncover your interviewer&#39;s greatest need, want, problem or goal. &lt;br /&gt;&lt;br /&gt;To do so, make you take these two steps:&lt;br /&gt;&lt;br /&gt;1.  Do all the homework you can before the interview to uncover this  person&#39;s wants and needs (not the generalized needs of the industry or  company)&lt;br /&gt;2. As early as you can in the interview, ask for a more  complete description of what the position entails.  You might say: “I  have a number of accomplishments I&#39;d like to tell you about, but I want  to make the best use of our time together and talk directly to your  needs. To help me do, that, could you tell me more about the most  important priorities of this position?  All I know is what I (heard from  the recruiter, read in the classified ad, etc.)”Then, ALWAYS follow-up with a second and possibly, third question, to  draw out his needs even more. Surprisingly, it&#39;s usually this second or  third question that unearths what the interviewer is most looking for.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;You  might ask simply, &quot;And in addition to that?...&quot; or, &quot;Is there anything  else you see as essential to success in this position?&lt;br /&gt;&lt;br /&gt;This  process will not feel easy or natural at first, because it is easier  simply to answer questions, but only if you uncover the employer&#39;s wants  and needs will your answers make the most sense. Practice asking these  key questions before giving your answers, the process will feel more  natural and you will be light years ahead of the other job candidates  you&#39;re competing with. &lt;br /&gt;&lt;br /&gt;After uncovering what the employer is  looking for, describe why the needs of this job bear striking parallels  to tasks you&#39;ve succeeded at before. Be sure to illustrate with specific  examples of your responsibilities and especially your achievements, all  of which are geared to present yourself as a perfect match for the  needs he has just described. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/1867775832041781289'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/1867775832041781289'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2012/12/tell-us-something-about-yourself.html' title='Tell us something about yourself'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-WQjGjHvd2jg/UN634Ea1xjI/AAAAAAAAAOs/3FnE7fbUS6Q/s72-c/Tell-me-about-yourself.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-6396643756813514049</id><published>2012-09-20T11:07:00.000-07:00</published><updated>2012-12-23T12:03:35.720-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Lateral Thinking Puzzles"/><title type='text'>Nunchuk Supreme</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Nunchuk Supreme&lt;/b&gt;&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-nhN81ftoK9Y/UFtaps8ywDI/AAAAAAAAAOY/QER0NsQn_qY/s1600/weapon.jpg&quot; imageanchor=&quot;1&quot;&gt;&lt;img alt=&quot;assailants&quot; border=&quot;0&quot; height=&quot;266&quot; src=&quot;http://1.bp.blogspot.com/-nhN81ftoK9Y/UFtaps8ywDI/AAAAAAAAAOY/QER0NsQn_qY/s400/weapon.jpg&quot; title=&quot;assailants&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif; text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Nunchuk Supreme is a powerful weapon that can be used to disable an unlimited number of assailants. To graduate from the Mangan Kung Fu Academy, one has to master the use of the Nunchuk Supreme. Think of it as a very long stick.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;The Nunchuk is thrown at the assailants and rotates in the air as it is thrown. It will strike an assailant, disable him/her and then using this person as a pivot, rotate about them and strike a second person and then rotate about the second person until it strikes a third person and rotates about them and so on until all of the assailants have been dealt with. Being disabled from fighting does not prevent being struck again by the Nunchuk and causing a change in the pivot of rotation.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Think of assailants as fixed points in the plane; is it always possible to choose a first assailant to strike, so that if no three assailants are collinear and the Nunchuck is long enough, then all assailants will be struck down?&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;status&quot;&gt;Y6JWDSSM9ZM3 &lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/6396643756813514049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/6396643756813514049'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2012/09/nunchuk-supreme-nunchuk-supreme-is.html' title='Nunchuk Supreme'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-nhN81ftoK9Y/UFtaps8ywDI/AAAAAAAAAOY/QER0NsQn_qY/s72-c/weapon.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-9137637515867025792</id><published>2012-02-18T20:43:00.000-08:00</published><updated>2013-06-29T07:52:48.359-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Einstein Puzzles"/><title type='text'>Einstein&#39;s Riddle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Einstein&#39;s Riddle&lt;/b&gt;&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-A4cpwLYGP4o/T0B9UfKUB_I/AAAAAAAAANo/RHBb_WSMZGU/s1600/albert-einstein2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;http://4.bp.blogspot.com/-A4cpwLYGP4o/T0B9UfKUB_I/AAAAAAAAANo/RHBb_WSMZGU/s400/albert-einstein2.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;ALBERT EINSTEIN&#39;S RIDDLE ARE YOU IN THE TOP 2% OF INTELLIGENT PEOPLE IN THE WORLD? SOLVE THE RIDDLE AND FIND OUT. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;There are no tricks, just pure logic, so good luck and don&#39;t give up. &lt;br /&gt;&lt;br /&gt;1. In a street there are five houses, painted five different colors. &lt;br /&gt;&lt;br /&gt;2. In each house lives a person of different nationality &lt;br /&gt;&lt;br /&gt;3. These five homeowners each drink a different kind of beverage, smoke different brand of cigar and keep a different pet.&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;THE QUESTION: &lt;b&gt;WHO OWNS THE FISH? &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;HINTS &lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp; 1. The British man lives in a red house. &lt;br /&gt;&amp;nbsp;&amp;nbsp; 2. The Swedish man keeps dogs as pets. &lt;br /&gt;&amp;nbsp;&amp;nbsp; 3. The Danish man drinks tea. &lt;br /&gt;&amp;nbsp;&amp;nbsp; 4. The Green house is next to, and on the left of the White house. &lt;br /&gt;&amp;nbsp;&amp;nbsp; 5. The owner of the Green house drinks coffee. &lt;br /&gt;&amp;nbsp;&amp;nbsp; 6. The person who smokes Pall Mall rears birds. &lt;br /&gt;&amp;nbsp;&amp;nbsp; 7. The owner of the Yellow house smokes Dunhill. &lt;br /&gt;&amp;nbsp;&amp;nbsp; 8. The man living in the center house drinks milk. &lt;br /&gt;&amp;nbsp;&amp;nbsp; 9. The Norwegian lives in the first house. &lt;br /&gt;&amp;nbsp;&amp;nbsp; 10. The man who smokes Blends lives next to the one who keeps cats. &lt;br /&gt;&amp;nbsp;&amp;nbsp; 11. The man who keeps horses lives next to the man who smokes Dunhill. &lt;br /&gt;&amp;nbsp;&amp;nbsp; 12. The man who smokes Blue Master drinks beer. &lt;br /&gt;&amp;nbsp;&amp;nbsp; 13. The German smokes Prince. &lt;br /&gt;&amp;nbsp;&amp;nbsp; 14. The Norwegian lives next to the blue house.&lt;br /&gt;&amp;nbsp;&amp;nbsp; 15. The Blends smoker lives next to the one who drinks water. &lt;br /&gt;&lt;br /&gt;ALBERT EINSTEIN WROTE THIS RIDDLE EARLY DURING THE 19th CENTURY. HE SAID THAT 98% OF THE WORLD POPULATION WOULD NOT BE ABLE TO SOLVE IT.&amp;nbsp;&amp;nbsp; &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Feel free to comment your answers and share to your friends.&lt;/div&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/9137637515867025792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/9137637515867025792'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2012/02/einsteins-riddle.html' title='Einstein&#39;s Riddle'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-A4cpwLYGP4o/T0B9UfKUB_I/AAAAAAAAANo/RHBb_WSMZGU/s72-c/albert-einstein2.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-401271851273102229</id><published>2012-02-07T18:09:00.000-08:00</published><updated>2013-06-12T02:59:28.227-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Image puzzles"/><title type='text'>Image Puzzle Find the Cat</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: center;&quot;&gt;Image Puzzle Find the Cat - i.&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-tm7MIN0Pmdk/TzHYMfnmM_I/AAAAAAAAANg/IqkcJBMVlwI/s1600/cat.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;find cat in the image&quot; border=&quot;0&quot; src=&quot;http://4.bp.blogspot.com/-tm7MIN0Pmdk/TzHYMfnmM_I/AAAAAAAAANg/IqkcJBMVlwI/s400/cat.png&quot; height=&quot;365&quot; title=&quot;find cat in the image&quot; width=&quot;500&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Find Cat - Image puzzle&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;There is a cat hidden in the above image. Try to find out. Feel free to comment.&lt;/div&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/401271851273102229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/401271851273102229'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2012/02/image-puzzle-find-cat.html' title='Image Puzzle Find the Cat'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-tm7MIN0Pmdk/TzHYMfnmM_I/AAAAAAAAANg/IqkcJBMVlwI/s72-c/cat.png" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-8056327870451144183</id><published>2011-07-24T11:40:00.000-07:00</published><updated>2013-06-12T03:00:41.942-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Interview Puzzle"/><title type='text'>Chasing Dogs Puzzle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;&lt;h1 class=&quot;post-head&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #444444; font-family: Tahoma, Geneva, Verdana, sans-serif; font-size: 22px; font: normal normal normal 24px/140% Georgia, &#39;Times New Roman&#39;, Times, serif; line-height: 22px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: center; vertical-align: baseline;&quot;&gt;&lt;u&gt;Chasing Dogs&amp;nbsp;Puzzle :&lt;/u&gt;&lt;/h1&gt;&lt;div style=&quot;color: #444444; font-family: Tahoma, Geneva, Verdana, sans-serif; font-size: 13px; line-height: 22px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; color: #444444; font-family: Tahoma, Geneva, Verdana, sans-serif; font-size: 13px; line-height: 22px; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-kr19I7WtdKs/TixmaPnkDPI/AAAAAAAAANc/Kp6CNpUrwLU/s1600/4dogs_8578.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;dogs&quot; border=&quot;0&quot; src=&quot;http://1.bp.blogspot.com/-kr19I7WtdKs/TixmaPnkDPI/AAAAAAAAANc/Kp6CNpUrwLU/s400/4dogs_8578.jpg&quot; height=&quot;266&quot; title=&quot;chasing dogs puzzle&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Tahoma, Geneva, Verdana, sans-serif; font-size: 13px; line-height: 22px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Tahoma, Geneva, Verdana, sans-serif; font-size: 13px; line-height: 22px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Tahoma, Geneva, Verdana, sans-serif; line-height: 22px;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Puzzle :&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Tahoma, Geneva, Verdana, sans-serif; font-size: 13px; line-height: 22px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Tahoma, Geneva, Verdana, sans-serif; line-height: 22px;&quot;&gt;&lt;div&gt;There are four dogs each at the corner of a unit square. Each of the dogs starts chasing the dog in the clockwise direction. They all run at the same speed and continuously change their direction accordingly so that they are always heading straight towards the other dog. How long does it take for the dogs to catch each other and where?&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;color: #444444; font-family: Tahoma, Geneva, Verdana, sans-serif; line-height: 22px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444; font-family: Tahoma,Geneva,Verdana,sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 22px;&quot;&gt;Have a better solution? Let us know through the comments section!&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444; font-family: Tahoma,Geneva,Verdana,sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 22px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444; font-family: Tahoma,Geneva,Verdana,sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 22px;&quot;&gt;Liked this question? Post this on Stumble, Twitter or Digg!&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444; font-family: Tahoma,Geneva,Verdana,sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 22px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/8056327870451144183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/8056327870451144183'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2011/07/chasing-dogs-puzzle.html' title='Chasing Dogs Puzzle'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-kr19I7WtdKs/TixmaPnkDPI/AAAAAAAAANc/Kp6CNpUrwLU/s72-c/4dogs_8578.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-2671410099401770900</id><published>2011-07-24T07:05:00.000-07:00</published><updated>2013-06-12T03:01:22.610-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Interview Puzzle"/><title type='text'>Heaven Puzzle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;u&gt;Heaven Puzzle.&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-zYor8UFeQCI/TiwkeNQ47bI/AAAAAAAAAM8/gkeoW_ya56k/s1600/heaven.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img alt=&quot;Heaven Puzzle&quot; border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/-zYor8UFeQCI/TiwkeNQ47bI/AAAAAAAAAM8/gkeoW_ya56k/s1600/heaven.jpg&quot; title=&quot;Heaven Puzzle&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;u&gt;&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;u&gt;Puzzle :&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;font-size: x-large; font-weight: bold; text-align: left; text-decoration: underline;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;A person dies, and he arrives at the gate to heaven. There are three doors in the heaven. one of them leads to heaven. another one leads to a 1-day stay at hell, and then back to the gate, and the other leads to a 2-day stay at hell, and then back to the gate. every time the person is back at the gate, the three doors are reshuffled. How long will it take the person to reach heaven?&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;this is a probability question - i.e. it is solvable and has nothing to do with religion, being sneaky, or how au dente the pasta might be ;-)&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;u&gt;Answer:&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;1/3 of the time, the door to heaven will be chosen, so 1/3 of the time it will take zero days. 1/3 of the time, the 1-day door is chosen; of those, the right door will be chosen the next day, so 1/9 trips take 1 day. Similarly, 1/9 will take two days (choosing the 2-day door, then the right door).&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;After that, the cases split again, and again, and again. I can’t seem to make a nice infinite sum this way, so let’s try again.&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Suppose the average days spent is X. 1/3 of the cases are done in zero days as before. 1/3 of the cases are 1 day plus X. 1/3 are 2 + X. So:&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;X = 1/3 * 0 + 1/3 * (1 + X) + 1/3 * (2 + X)&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&amp;nbsp; = 0 + 1/3 + X/3 + 2/3 + X/3&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&amp;nbsp; = 1 + 2X/3&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Therefore,&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&amp;nbsp; X/3 = 1&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&amp;nbsp; &amp;nbsp; X = 3&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;On average, it takes three days to get to heaven. Two if the noodles are limp.&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Took me one blind alley, and about five minutes.&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/2671410099401770900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/2671410099401770900'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2011/07/heaven-puzzle.html' title='Heaven Puzzle'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-zYor8UFeQCI/TiwkeNQ47bI/AAAAAAAAAM8/gkeoW_ya56k/s72-c/heaven.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-7909648884353031939</id><published>2011-01-25T10:55:00.000-08:00</published><updated>2013-07-01T05:44:16.499-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Interview Puzzle"/><title type='text'>Chess Board Puzzle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a class=&quot;thickbox&quot; href=&quot;http://1.bp.blogspot.com/_pxUNdWyjHeo/TT8cVoMiPRI/AAAAAAAAAMc/ClJA-XHSnYI/s1600/chess.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;chess board puzzle&quot; border=&quot;0&quot; src=&quot;http://1.bp.blogspot.com/_pxUNdWyjHeo/TT8cVoMiPRI/AAAAAAAAAMc/ClJA-XHSnYI/s400/chess.jpg&quot; height=&quot;266&quot; title=&quot;chess board&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;Chess&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;Chess Board Puzzle :&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Imagine there are infinite number of Queens (Chess Game Piece) with u. Find the minimum number of queens required so that every square grid on the chess board is under the attack  of a queen. Arrange this minimum no. of Queens on a chess board. &lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;u&gt;Answer :&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt; &lt;/span&gt;&lt;br /&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableGrid&quot; style=&quot;border-bottom: medium none; border-collapse: collapse; border-left: medium none; border-right: medium none; border-top: medium none;&quot;&gt;&lt;tbody&gt;&lt;tr style=&quot;height: 19.45pt;&quot;&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: black 1pt solid; border-right: black 1pt solid; border-top: black 1pt solid; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: black 1pt solid; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: black 1pt solid; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: black 1pt solid; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: black 1pt solid; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: black 1pt solid; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: black 1pt solid; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: black 1pt solid; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 19.45pt;&quot;&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: black 1pt solid; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/_pxUNdWyjHeo/TUPD-BfMroI/AAAAAAAAAMg/1aFjQ5LQ8FQ/s1600/Chess+Queen.bmp&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/_pxUNdWyjHeo/TUPD-BfMroI/AAAAAAAAAMg/1aFjQ5LQ8FQ/s1600/Chess+Queen.bmp&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 19.45pt;&quot;&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: black 1pt solid; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 19.45pt;&quot;&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: black 1pt solid; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/_pxUNdWyjHeo/TUPD-BfMroI/AAAAAAAAAMg/1aFjQ5LQ8FQ/s1600/Chess+Queen.bmp&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/_pxUNdWyjHeo/TUPD-BfMroI/AAAAAAAAAMg/1aFjQ5LQ8FQ/s1600/Chess+Queen.bmp&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/_pxUNdWyjHeo/TUPD-BfMroI/AAAAAAAAAMg/1aFjQ5LQ8FQ/s1600/Chess+Queen.bmp&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/_pxUNdWyjHeo/TUPD-BfMroI/AAAAAAAAAMg/1aFjQ5LQ8FQ/s1600/Chess+Queen.bmp&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 19.45pt;&quot;&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: black 1pt solid; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/_pxUNdWyjHeo/TUPD-BfMroI/AAAAAAAAAMg/1aFjQ5LQ8FQ/s1600/Chess+Queen.bmp&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/_pxUNdWyjHeo/TUPD-BfMroI/AAAAAAAAAMg/1aFjQ5LQ8FQ/s1600/Chess+Queen.bmp&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 19.45pt;&quot;&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: black 1pt solid; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/_pxUNdWyjHeo/TUPD-BfMroI/AAAAAAAAAMg/1aFjQ5LQ8FQ/s1600/Chess+Queen.bmp&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/_pxUNdWyjHeo/TUPD-BfMroI/AAAAAAAAAMg/1aFjQ5LQ8FQ/s1600/Chess+Queen.bmp&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 19.45pt;&quot;&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: black 1pt solid; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;height: 19.45pt;&quot;&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: black 1pt solid; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt; &lt;td style=&quot;border-bottom: black 1pt solid; border-left: medium none; border-right: black 1pt solid; border-top: medium none; height: 19.45pt; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 24.6pt;&quot; valign=&quot;top&quot; width=&quot;33&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/_pxUNdWyjHeo/TUPD-BfMroI/AAAAAAAAAMg/1aFjQ5LQ8FQ/s1600/Chess+Queen.bmp&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/_pxUNdWyjHeo/TUPD-BfMroI/AAAAAAAAAMg/1aFjQ5LQ8FQ/s1600/Chess+Queen.bmp&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Indicates Queen.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/7909648884353031939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/7909648884353031939'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2011/01/chess-board-puzzle.html' title='Chess Board Puzzle'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_pxUNdWyjHeo/TT8cVoMiPRI/AAAAAAAAAMc/ClJA-XHSnYI/s72-c/chess.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-1345660542187894950</id><published>2010-09-22T09:43:00.000-07:00</published><updated>2013-06-12T03:02:30.741-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Interview Puzzle"/><title type='text'>Tumblers on a Rotating Table</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a class=&quot;thickbox&quot; href=&quot;http://4.bp.blogspot.com/_pxUNdWyjHeo/TJoxkAoDk-I/AAAAAAAAALg/Guj5I6kQxnU/s1600/Four_Tumblers.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Four Tumblers&quot; border=&quot;0&quot; src=&quot;http://4.bp.blogspot.com/_pxUNdWyjHeo/TJoxkAoDk-I/AAAAAAAAALg/Guj5I6kQxnU/s400/Four_Tumblers.jpg&quot; height=&quot;400&quot; title=&quot;Four Tumblers&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;Tumblers on a Rotating Table Puzzle :&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A blind gnome and an evil goblin take turns to play a game. Four  tumblers are placed at the corners of a square table. The initial  configuration of the tumblers (facing up or facing down) is chosen by  the evil goblin. When the blind gnome gets his turn, he is allowed to  specify a subset of the four tumblers and flip them simultaneously. To  be precise, he may choose “one tumbler”, “two diagonally opposites”,  “two adjacent”, “three tumblers” or “four tumblers” lying in front of  him, and flip them simultaneously. After flipping, if all four tumblers  are upright, he wins the game! Otherwise, the game continues and the  evil goblin is allowed to rotate the table by an  amount of his choice.  Can the blind gnome win the game with a &lt;i&gt;deterministic&lt;/i&gt; strategy?&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;Solution :&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If there were only two cards, then “flip both” — “flip one” — “flip  both” would ensure a victory for the blind gnome. For the case of four  cards, let F denote “all four cards”, A denote “two adjacent cards”, D  denote “two diagonally opposite cards”, O denote “one card”. Then the  following 15-step sequence ensures victory for the blind gnome: F, D, F,  A, F, D, F, O, F, D, F, A, F, D, F. The procedure can be generalized to  2^n cards. This problem is studied in detail by Ehrenborg and Skinner  (see bibliography below); they call it “The Blind Bartender’s Problem”.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; A variant of the above problem allows the blind gnome to first  “touch” any t out of n tumblers on a polygonal table with n sides.  Touching allows the gnome to deduce which of the t tumblers he touched  are upright, and then to decide which of these t tumblers to flip. It  was this variant that was originally published in Martin Gardner’s  article in Feb 1979. For four tumblers, the blind gnome can win in five  moves, as Gardner showed in his subsequent article in Mar 1979. The  problem generated quite some interest. Two pairs of mathematicians  independently proved that the blind gnome can win with a deterministic  strategy if and only if t ≥ n(p-1)/p where p is the largest prime factor  of n (Lewis and Willard in 1980; Laaser and Ramshaw 1981). These proofs  are quite involved&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/1345660542187894950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/1345660542187894950'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2010/09/tumblers-on-rotating-table.html' title='Tumblers on a Rotating Table'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_pxUNdWyjHeo/TJoxkAoDk-I/AAAAAAAAALg/Guj5I6kQxnU/s72-c/Four_Tumblers.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-11075428084374253</id><published>2010-09-08T10:23:00.000-07:00</published><updated>2013-06-12T03:02:08.475-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Interview Puzzle"/><title type='text'>Mars Rovers thoughtworks puzzles</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a class=&quot;thickbox&quot; href=&quot;http://3.bp.blogspot.com/_pxUNdWyjHeo/TIfCXH-xBwI/AAAAAAAAALY/_2vPsiSSOvg/s1600/mars_rover.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Mars rovers&quot; border=&quot;0&quot; src=&quot;http://3.bp.blogspot.com/_pxUNdWyjHeo/TIfCXH-xBwI/AAAAAAAAALY/_2vPsiSSOvg/s400/mars_rover.jpg&quot; height=&quot;267&quot; title=&quot;Mars rovers&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;Mars Rovers is one of the famous puzzle asked by many companies while recruiting people for them. Here the problem is defined and answers are given with Java program.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://interviewpuzzle.blogspot.com/2010/09/mars-rovers-thoughtworks-puzzles.html#Mars_Rovers_Puzzle&quot;&gt;Mars Rovers Puzzle&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://interviewpuzzle.blogspot.com/2010/09/mars-rovers-thoughtworks-puzzles.html#input&quot;&gt;Input&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://interviewpuzzle.blogspot.com/2010/09/mars-rovers-thoughtworks-puzzles.html#output&quot;&gt;Output&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://interviewpuzzle.blogspot.com/2010/09/mars-rovers-thoughtworks-puzzles.html#input_and_output&quot;&gt;Input and Output&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://interviewpuzzle.blogspot.com/2010/09/mars-rovers-thoughtworks-puzzles.html#solution&quot;&gt;Solution&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-large;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://interviewpuzzle.blogspot.com/2010/09/mars-rovers-thoughtworks-puzzles.html&quot; name=&quot;Mars_Rovers_Puzzle&quot;&gt;Mars Rovers thoughtworks puzzles&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A squad of robotic rovers are to be landed by NASA on a plateau on Mars. This plateau, which is curiously rectangular, must be navigated by the rovers so that their on-board cameras can get a complete view of the surrounding terrain to send back to Earth.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A rover&#39;s position and location is represented by a combination of x and y co-ordinates and a letter representing one of the four cardinal compass points. The plateau is divided up into a grid to simplify navigation. An example position might be 0, 0, N, which means the rover is in the bottom left corner and facing North.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;In order to control a rover, NASA sends a simple string of letters. The possible letters are &#39;L&#39;, &#39;R&#39; and &#39;M&#39;. &#39;L&#39; and &#39;R&#39; makes the rover spin 90 degrees left or right respectively, without moving from its current spot. &#39;M&#39; means move forward one grid point, and maintain the same heading.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;Assume that the square directly North from (x, y) is (x, y+1).&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://interviewpuzzle.blogspot.com/2010/09/mars-rovers-thoughtworks-puzzles.html&quot; name=&quot;input&quot;&gt;INPUT:&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;The first line of input is the upper-right coordinates of the plateau, the lower-left coordinates are assumed to be 0,0.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;The rest of the input is information pertaining to the rovers that have been deployed. Each rover has two lines of input. The first line gives the rover&#39;s position, and the second line is a series of instructions telling the rover how to explore the plateau.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;The position is made up of two integers and a letter separated by spaces, corresponding to the x and y co-ordinates and the rover&#39;s orientation.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;Each rover will be finished sequentially, which means that the second rover won&#39;t start to move until the first one has finished moving.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;a href=&quot;http://interviewpuzzle.blogspot.com/2010/09/mars-rovers-thoughtworks-puzzles.html&quot; name=&quot;output&quot;&gt;&lt;b&gt;OUTPUT:&lt;/b&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;The output for each rover should be its final co-ordinates and heading.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://interviewpuzzle.blogspot.com/2010/09/mars-rovers-thoughtworks-puzzles.html&quot; name=&quot;input_and_output&quot;&gt;INPUT AND OUTPUT:&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;i&gt;&lt;b&gt;Test Input:&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;5 5&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;1 2 N&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;LMLMLMLMM&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;3 3 E&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;MMRMMRMRRM&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;i&gt;&lt;b&gt;Expected Output:&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;1 3 N&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;5 1 E&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;==========&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://interviewpuzzle.blogspot.com/2010/09/mars-rovers-thoughtworks-puzzles.html&quot; name=&quot;solution&quot;&gt;SOLUTION :&lt;/a&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Administrator removed the solution. Try your own.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/11075428084374253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/11075428084374253'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2010/09/mars-rovers-thoughtworks-puzzles.html' title='Mars Rovers thoughtworks puzzles'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_pxUNdWyjHeo/TIfCXH-xBwI/AAAAAAAAALY/_2vPsiSSOvg/s72-c/mars_rover.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-6149692539226863505.post-2685394359170294607</id><published>2010-09-03T03:18:00.000-07:00</published><updated>2013-06-12T03:03:35.843-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Lateral Thinking Puzzles"/><title type='text'>Covent Garden Puzzle</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a class=&quot;thickbox&quot; href=&quot;http://1.bp.blogspot.com/_pxUNdWyjHeo/TIDK6X3t9LI/AAAAAAAAALQ/gi_XSKU9cm4/s1600/Apple-of-Kashmir-India_620.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; cssfloat: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img alt=&quot;Apples&quot; border=&quot;0&quot; src=&quot;http://1.bp.blogspot.com/_pxUNdWyjHeo/TIDK6X3t9LI/AAAAAAAAALQ/gi_XSKU9cm4/s320/Apple-of-Kashmir-India_620.jpg&quot; ox=&quot;true&quot; title=&quot;Apples&quot; /&gt;&lt;/a&gt;&lt;a class=&quot;thickbox&quot; href=&quot;http://2.bp.blogspot.com/_pxUNdWyjHeo/TIDK4bKeYvI/AAAAAAAAALI/8tuWeBbzpWs/s1600/apple%2520scrumptious.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Apples in the tree&quot; border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/_pxUNdWyjHeo/TIDK4bKeYvI/AAAAAAAAALI/8tuWeBbzpWs/s320/apple%2520scrumptious.jpg&quot; ox=&quot;true&quot; title=&quot;Apples in the tree&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;u&gt;Covent Garden Puzzle&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Mrs. Ram and Mrs. Jones had equal number of apples but Mrs. Jones had larger fruits and was selling hers at the rate of two for a penny, while Mrs. Ram sold three of hers for a penny. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Mrs. Ram was for some reason called away and asked Mrs. Jones to dispose of her stock. Upon accepting the responsibility of disposing her friend&#39;s stock, Mrs. Jones mixed them together and sold them of at the rate of five apples for two pence.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;When Mrs. Ram returned the next day the apples had all been disposed of, but when they came to divide the proceeds they found that they were just seven pence short, and it is this shortage in the apple or financial market which has disturbed the mathematical equilibrium for such a long period.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Supposing that they divided the money equally, each taking one-half, the problem is to tell just how much money Mrs. Jones lost by the unfortunate partnership? &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;nbsp; &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;u&gt;Puzzle Solution&lt;/u&gt;&lt;/span&gt;&lt;/b&gt; &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&amp;nbsp; &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The mixed apples were sold of at the rate of five apples for two pence. So they must have had a multiple of five i.e. 5, 10, 15, 20, 25, 30,…, 60, 65,… etc apples. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;But the minimum number of apples they could have together is 60; so that 30 would have been of Mrs. Ram&#39;s that would fetch her 10 (an integer) pence and the other 30 of Mrs. Jones&#39;s that would fetch her 15 (also an integer) pence. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;When sold separately it would fetch them 10+15=25 pence altogether. But when sold together it would fetch them 60X2/5=24 pence i.e. a loss of one (25-24=1) pence. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Since they lost 7 pence altogether; they had altogether 60X7=420 apples that fetched them only 420X2/5=168 pence and they shared 84 pence each of them. But Mrs. Jones could sell her 420/2=210 apples for 210/2=105 pence so she lost &quot;21 pence&quot;. &lt;/div&gt;Note: to solve it algebraically:&lt;br /&gt;They lost 7 pence altogether&lt;br /&gt;Suppose each lady has x apples&lt;br /&gt;x/2 + x/3 - 2(2x/5) = 7&lt;br /&gt;&lt;br /&gt;15x + 10x - 24x = 210&lt;br /&gt;&lt;br /&gt;x = 210&lt;br /&gt;Note: Mrs. Johns lost 21 pence.&lt;br /&gt;&lt;br /&gt;But without working Mrs. Ram earned 14 extra pence!&lt;br /&gt;&lt;br /&gt;(84 pence – 210/3 pence = 14 pence).&lt;br /&gt;&lt;br /&gt;Not very fair!&lt;br /&gt;&lt;br /&gt;(Perhaps Mrs. Johns was not very good at math)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/2685394359170294607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6149692539226863505/posts/default/2685394359170294607'/><link rel='alternate' type='text/html' href='http://www.techinterviewpuzzles.com/2010/09/covent-garden-puzzle.html' title='Covent Garden Puzzle'/><author><name>Interview Puzzles</name><uri>http://www.blogger.com/profile/16290304124116073117</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_pxUNdWyjHeo/TIDK6X3t9LI/AAAAAAAAALQ/gi_XSKU9cm4/s72-c/Apple-of-Kashmir-India_620.jpg" height="72" width="72"/></entry></feed>