BinaryGap Test for codility

问题的原文请参考链接:
https://app.codility.com/programmers/lessons/1-iterations/binary_gap/

有关问题的解答思路和翻译,请参考:https://www.cwiki.us/display/ITCLASSIFICATION/Binary+Gap
This commit is contained in:
YuCheng Hu 2018-12-23 16:29:50 -05:00
parent 2d93b0f795
commit 3c98c4008d
1 changed files with 3 additions and 17 deletions

View File

@ -27,23 +27,9 @@ public class LintCode1480DotProductTest {
@Test
public void testMain() {
logger.debug("BEGIN");
int[] A = { 1, 1, -1 };
int[] B = { 2147483647, 1, 3 };
int retStatus = 0;
// LENGTH CHECK
if (A.length == 0 || B.length == 0 || A.length != B.length)
retStatus = -1;
// ADDED
if (retStatus != -1) {
for (int i = 0; i < A.length; i++) {
retStatus = retStatus + A[i] * B[i];
}
}
System.out.println(retStatus);
int t = 87;
int[] dur = { 20, 25, 19, 37 };
// Write your code here
}
}