Company: Texas

Difficulty: medium

Problem Statement

Maximum Sum With Distinct Least Significant Set Bits You are given a non-empty list of positive integers on one line. Choose a subset with maximum possible sum such that no two chosen numbers have the same least significant set-bit position. Bit positions are zero-based from the right. Input Format One line contains the positive integers, separated by spaces. Output Format Print the maximum possible subset sum. Notes For a positive integer `x`, its least significant set-bit value is `x & -x`; equal values mean equal least-significant set-bit positions. The list length is inferred from the tokens in the line. Example Input: `2 5 7 3 9 11` Output: `13` Choose `2` and `11`.

More Texas OA questionsInterview experiences