Member-only story
#JavaSolved : Bitwise One
Have the function BitwiseOne(strArr) take the array of strings stored in strArr, which will only contain two strings of equal length that represent binary numbers, and return a final binary string that performed the bitwise OR operation on both strings. A bitwise OR operation places a 0 in the new string where there are zeroes in both binary strings, otherwise it places a 1 in that spot. For example: if strArr is [โ1001โ, โ0100โ] then your program should return the string โ1101โ.
Examples
Input: new String[] {โ100โ, โ000โ}
Output: 100
Input: new String[] {โ00011โ, โ01010โ}
Output: 01011
import java.util.*;
import java.io.*;
class Main {
static String BitwiseOne(String[] strArr) {
String res=โโ;
int max_size = Integer.MIN_VALUE;
for (int i=0; i<strArr.length; i++){
max_size = Math.max(max_size, (int)strArr[i].length());
strArr[i] = reverse(strArr[i]);
}
for (int i=0; i<strArr.length;i++){
String m=โโ;
for (int j=0; j<max_size-strArr[i].length(); j++)
