diff options
Diffstat (limited to 'progs/a283.py')
-rw-r--r-- | progs/a283.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/progs/a283.py b/progs/a283.py new file mode 100644 index 0000000..dc0e112 --- /dev/null +++ b/progs/a283.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 (num == new_num):
+ return True
+ return False
\ No newline at end of file |