|
|
вернуться в форумПоказать все сообщения Спрятать все сообщенияWA #6 Harry 5 окт 2014 01:09 Please! Give me some tests. Me too!Have you solved this problem? Re: WA #6 SButterfly [Samara SAU] 7 ноя 2014 23:03 I have this WA too. Firstly, I used binary search to find the last element, which didn't fall. And my mistake was: if (currentSum == k) return med; the corrent ones: if (currentSum == k) return med-1; And for case, where we haven't found exactly k sum: .. }//end of binary search int answerIndex = l; int sum = getSum(left, lastAdded Index); if (sum <= k){ answerIndex = l - 1; } return answerIndex; But now I have TL11 |
|
|