
Untitled
By: a guest on
Apr 25th, 2012 | syntax:
None | size: 0.76 KB | hits: 18 | expires: Never
Java confusion on fundamentals on double and integer and conversions
public double findMedianSortedArrays(int A[], int B[])
Input Output Expected
[], [1] 1.0 1
[2], [] 2.0 2
if(array.length %2 == 0){
return (array[middle] + array[middle - 1])/(double)2;
}
else{
return (double)array[middle];
}
public class Solution {
public double findMedianSortedArrays(int A[], int B[]) {
// Start typing your Java solution below
// DO NOT write main() function
return 0;
}
}
class Solution {
public:
double findMedianSortedArrays(int A[], int m, int B[], int n) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
return 0;
}
};