We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Someone correct me if im mistaken, but the example is wrong when it iterates
over element 7 twice.
On line where it states 'Remove 6,7, return ' after this there should be no '7' present in the exmple array A.
The next line states 'Finaly, remove 8,7 ' but 7 has already been removed in the previous line.
so it should read as follows;
Remove 6,7, return 6+ 2 * 7 = 20 ans A= 20,16,8
Remove 8,16, return 8+ 2 * 16 = 40 ans A= [40,20]
stop as values are above 9, that is still 4 iteration
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Jesse and Cookies
You are viewing a single comment's thread. Return to all comments →
Someone correct me if im mistaken, but the example is wrong when it iterates over element 7 twice. On line where it states 'Remove 6,7, return ' after this there should be no '7' present in the exmple array A. The next line states 'Finaly, remove 8,7 ' but 7 has already been removed in the previous line. so it should read as follows; Remove 6,7, return 6+ 2 * 7 = 20 ans A= 20,16,8 Remove 8,16, return 8+ 2 * 16 = 40 ans A= [40,20] stop as values are above 9, that is still 4 iteration