diff --git a/Q3/solution.py b/Q3/solution.py index 18ab591..f54f93a 100644 --- a/Q3/solution.py +++ b/Q3/solution.py @@ -1,3 +1,18 @@ -class Solution: - def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: - +# first we need to sort two arrays using time complexity +a=[] +b=[] +# using for loop and time +for each x in b + insert x into a + or q from 1 to m + if q == 1 then insert b[q] into a + else + insert b[q] into a starting from the position of b[q-1] + return length + #Now we have merged array length we can easily find median for odd and even case + length =len (merged_array) + if length % 2 == 0 : + med = (merged_array[(length/2)-1] + merged_array [length/2]/2 + else : + med =merged_array [int(length/2)] +