Minimum number of AND operations to make all array elements zero

I came across this question in a programming contest:We are given an array consisting of n elements. At each iteration, you can select any two elements ai and aj and replace ai with ai & aj. & is the bitwise AND operator. Find the minimum number of AND operations needed...

Issues with understanding Dining table optimal seating algorithm

I was reading through a problem and was trying to solve this problem.You've invited N people over for dinner. Let's say 4.

Pairing numbers (a,b) in an array such a way that a*2 >=b

I am trying to solve pairing numbers (a,b) in an array such a way that a*2 >=b. Where a and b are numbers from input array.

Why does my code take different values when i switch the order in a set (knowing that order doesn't matter with sets)

I'm trying to implement a method that returns the edges of a graph, represented by an adjacency list/dictionary.

Verify there is a combination of unique string

1) If there is List of Details as in List<Details> how to verify for a combination of name and email collectively unique. (i.e) For a single email address there cant be two name entry.

Verify there is a combination of unique string

1) If there is List of Details as in List<Details> how to verify for a combination of name and email collectively unique. (i.e) For a single email address there cant be two name entry.

Fastest algorithm to perform N*M iterations in Python

I am not an algorithm person, so pardon the naivety of the question. I have a list A containing elements 100K elements. I have another list B containing 100K elements. Let's say a is an element from list A, b is the element from list B. I want to find...

What is the time complexity of getting the max key of a std::map in C++?

I'm trying to find the largest value in a std::map, which would be the last node in the tree (since std::map keys are sorted).