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.
Bitwise AND
Bitwise AND
Sort by
recency
|
59 Discussions
|
Please Login in order to post a comment
public static int bitwiseAnd(int n, int k) { int max = 0; for (int i = 1; i <= n; i++) { if (i == k-1) continue; int val = i&(k-1); if (val > max && val < k) max = val; } return max; }
}
class Result {
int max = 0; for (int i = 1; i <= n; i++) { if (i == k-1) continue; int val = i&(k-1); if (val > max && val < k) max = val; } return max; }
}
public class Solution { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
}
class Result {
int max = 0; for (int i = 1; i <= n; i++) { if (i == k-1) continue; int val = i&(k-1); if (val > max && val < k) max = val; } return max; }
}
public class Solution { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
}
https://www.hackerrank.com/challenges/linkedin-practice-bitwise-and/submissions
include
include
include
include
include
include
include
int main() { int t,i,j; scanf("%d",&t); for(int a0 = 0; a0 < t; a0++) { int n; int k; int x,y=0; scanf("%d %d",&n,&k); for(i=n;i>0;--i) for(j=n-1;j>1;--j) { x=(i & j); { if(x>y && xwhat is wrong in this program