Number with set bits only between L | Function to return the integer with all the bits set in range L - R ; Driver Code
def setbitsfromLtoR ( L , R ) : NEW_LINE INDENT return ( ( 1 << ( R + 1 ) ) - ( 1 << L ) ) NEW_LINE DEDENT L = 2 NEW_LINE R = 5 NEW_LINE print ( setbitsfromLtoR ( L , R ) ) NEW_LINE