## k-partition the array so as to maximize ‘bit-wise and’ of sums(of elements in partitions)

We are given with an array and a number k.

We need to partition array into k parts so as to maximize ‘bit-wise and’ of sums(of elements in a partition).

Note that we need to find this maximum ‘bit-wise and’ value

For example:

Example 1:

Array: 30, 15, 26, 16, 21, 13, 25, 5, 27, 11

k: 3

Solution: We can partition array into {30, 15} {26, 16, 21, 13, 25} {5, 27, 11}

to get result as (30+15)&(26+16+21+13+25)&(5+27+11) i.e. 33.

where & represents ‘bit-wise and’ operation.

Let’s have a look on another example.

Example 2:

Array: 2, 0, 1, 2, 0

k: 1

Solution: Since k=1, array itself is the required partition. So result is (2+0+1+2+0) i.e. 5.

I have tried brute-force but it is a slow algorithm and takes too long to produce results. Time limit is 1 second. In brute force i tried all set of partitions and for each set find sum of elements in all partitions and then take bit-wise and of all of these sums. I am struggling to make an optimized solution.Please anyone help me out.

## Handling $AND$ and $OR$ cases in MILP?

Suppose I want to have an integer program for handling the cases

1. $$x_1>1\wedge x_2>1\wedge x_3>1\wedge\dots\wedge x_n>1\iff\delta=1$$

2. $$x_1>1\vee x_2>1\vee x_3>1\vee\dots\vee x_n>1\iff\delta=1$$

how many number of integer variables are needed to handle case?

Is it possible at least one of them needs at most a constant number of binary variables?

## Erro no Mongoose Query com $And.$Or e $Not no$match

Estou tentando executar a seguinte query dentro de um Aggregate do Mongoose

$match: {$  and:[         {$or: [{"person_id":1}, {"person_id":2}]}, {$  not: {group_id: ""}}     ] } 

mas estou recebendo o seguinte erro

## Copying data to *and from* another sheet based on the month of a date

This is a follow-up to Copying data to another sheet based on the month of a date, with a different requirement: instead of one-way data transfer (from Master sheet to others), two-directional transfer is needed.

### Background

I have a sheet (Master) which has rows of data regarding different types of projects and deliverables.

One column in this sheet has a date value under column header “closingDate”. The deliverable dates extend through the year. For example. we may create an entry today in the Master, for a project that is due to close in September of next year.

We need to be able to see what are the deliverables for a particular month. The years don’t matter. All projects closing in Jan 2016, 2017, 2018, etc.

For reasons that I can not state we can’t use filter or filter views in the Master Sheet.

An ideal solution for us would be to have sheets named Jan, Feb, March, April, etc.

Each time a record is added to the Master, depending upon the month of the closingDate a copy of the record is made in the sheet named after the month. Each time the record is edited in the master sheet the corresponding record is also updated.

### New aspect

While the Filter works well, it has engineered another demand for me. Is it possible for creating the subset (filtered by Month) in a way that if we were to make changes in that subset view, those changes would cascade back to the Master. Would QUERY work? Or do I have to resort to a script. Or it is not possible.

## How ‘AND’ and ‘OR’ can be combined in advanced twitter search operators?

I want to find tweets including one of these three possibility in search results:

• AAAA” and “BBBB

or

• AAAA” and “CCCC

or

• AAAA” and “BBBB” and “CCCC

I mean that AAAA should be in tweets results and one (or both) of BBBB and CCCC should be included too.

How AAAA, BBBB and CCCC should be arranged using one AND operator and one OR operator to get the described result?