diff options
Diffstat (limited to 'progs/a591.py')
-rw-r--r-- | progs/a591.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/progs/a591.py b/progs/a591.py new file mode 100644 index 0000000..3ddb9b2 --- /dev/null +++ b/progs/a591.py @@ -0,0 +1,6 @@ +def all_Bits_Set_In_The_Given_Range(n,l,r):
+ num = (((1 << r) - 1) ^ ((1 << (l - 1)) - 1))
+ new_num = n & num
+ if (new_num == 0):
+ return True
+ return False
\ No newline at end of file |