You are viewing a single comment's thread. Return to all comments →
I had difficulty understanding what was to be done (I don't speak English natively).
So I decided to divide the code like this:
const getMaxLessThanK = (n,k) => { let maxBitwiseValue = 0 const bitwiseValues = [] for(let a = 1; a < n; a++){ for(let b = a + 1; b <= n; b++){ bitwiseValues.push(a & b) } } bitwiseValues.forEach(bitwiseValue => { if(bitwiseValue < k && bitwiseValue > maxBitwiseValue){ maxBitwiseValue = bitwiseValue } }) return maxBitwiseValue }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 6: Bitwise Operators
You are viewing a single comment's thread. Return to all comments →
I had difficulty understanding what was to be done (I don't speak English natively).
So I decided to divide the code like this: