Fedor and New Game Problem

Fedor and New Game Problem — ExecCode Medium DSA Practice

Solve the Fedor and New Game problem on ExecCode. Free online medium DSA practice in Bit Manipulation. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Each army is an integer whose binary bits say which soldier types are present. Count how many armies in armies differ from fedor in at most k bit positions. Fedor's own mask is not in the list. Return how many armies differ in at most k bits. You are given: armies — armies fedor — fedor k — k Return how many armies differ in at most k bits. Copied from OA Lab Part 1.

Examples

Input {'armies': [1, 2, 3], 'fedor': 0, 'k': 1}; Output 2. Input {'armies': [0], 'fedor': 0, 'k': 0}; Output 1. Input {'armies': [1, 2, 3], 'fedor': 3, 'k': 0}; Output 1

Constraints

Follow the statement. Use a 64-bit integer when values can overflow.

Practice Fedor and New Game free on ExecCode. Browse DSA problems, topic map, and placement guides.