diff --git a/Bit Algorithm/Check if A Number is Power of Two/SolutionByDhaval.py b/Bit Algorithm/Check if A Number is Power of Two/SolutionByDhaval.py new file mode 100644 index 000000000..203f07a6b --- /dev/null +++ b/Bit Algorithm/Check if A Number is Power of Two/SolutionByDhaval.py @@ -0,0 +1,18 @@ +int = int(input()) + + +def checkPowerOfTwo(num): + power = 0 + isPower = "No" + + while power <= int: + if 2 ** power == int: + isPower = "Yes" + break + else: + power += 1 + + return isPower + + +print(checkPowerOfTwo(int)) diff --git a/Divide and Conquer/Median of Two Sorted Array/SolutionByDhaval.py b/Divide and Conquer/Median of Two Sorted Array/SolutionByDhaval.py new file mode 100644 index 000000000..9dc30ec0e --- /dev/null +++ b/Divide and Conquer/Median of Two Sorted Array/SolutionByDhaval.py @@ -0,0 +1,11 @@ +import statistics + +len1 = int(input()) +arr1 = list(map(int, input().split(" "))) +len2 = int(input()) +arr2 = list(map(int, input().split(" "))) + +arr = arr1 + arr2 +arr.sort() + +print(statistics.median(arr))