Maximum AND (&) | Sololearn: Learn to code for FREE!

+5

Maximum AND (&)

Given an array of elements, you can pick at most one element of the array and increment or decrement it by any value. The task is to maximize the AND of the resulting array. Note: AND of the array is defined as the bitwise AND(&) of the the array elements. Input : N = 3 A[] = { 1, 2, 3 } Output: 2 Input : N = 2 A[] = { 10, 10 } Output: 10 Credit: GeeksForGeeks

11/21/2021 2:49:36 PM

Mohd Aadil

6 Answers

New Answer

+8

https://code.sololearn.com/ccT610rUSXXM/?ref=app

+5

My attempt: https://code.sololearn.com/cZo72HqLMNSI/?ref=app

+5

https://code.sololearn.com/cblCu89M0A1e/?ref=app

+4

https://code.sololearn.com/cb4Ad7CxCn48/?ref=app

+2

https://code.sololearn.com/cYp18RZeYrf2/?ref=app

0

I didn't get any solution.