Capgemini, Recently Asked Online Assessments in 24 Jan, 2026 9am slot | Set Bits Sorting | Smallest Missing Character

Capgemini · Question · Posted Mar 2026

Question 1: Set Bits Problem Problem Statement: You are given an integer N. Your task is to sort the natural numbers from 1 to N on the basis of increasing order of the number of set bits in their binary representation. If two or more numbers have the same number of set bits then the one which has a larger decimal number representation will come first. Input format: The input consist of a single lines: The first and only line ...

The full answer & interview discussion are available to premium members.

Log in Create a free account