# 3315. Construct the Minimum Bitwise Array II in F#

## URL

[Construct the Minimum Bitwise Array II - LeetCode](https://leetcode.com/problems/construct-the-minimum-bitwise-array-ii/description/?envType=daily-question&envId=2026-01-21)

## Code

[https://github.com/syohex/dotnet-study/tree/main/fsharp/leetcode/challenge/202601/construct\_the\_minimum\_bitwise\_array2/main.fsx](https://github.com/syohex/dotnet-study/tree/main/fsharp/leetcode/challenge/202601/construct_the_minimum_bitwise_array2/main.fsx)

```fsharp
let minBitwiseArray (nums: int list) : int list =
    let rec f n mask =
        if n &&& mask = 0 then
            n &&& ~~~(mask >>> 1)
        else
            f n (mask <<< 1)

    nums |> List.map (fun n -> if n % 2 = 0 then -1 else f n 1)
```
