# Easy understanding code running works elsewhere but not leetcode

• from math import ceil, floor

class Solution:
# @param {integer[]} nums1
# @param {integer[]} nums2
# @return {float}
def findMedianSortedArrays(self, nums1, nums2):
def findKthSortedArrays(k, nums1, nums2):
length_nums1 = len(nums1)
length_nums2 = len(nums2)

``````        i = int(floor((length_nums1/(length_nums1 + length_nums2)) * k))
j = k - i

if length_nums1 == 0:
return nums2[k-1]
if length_nums2 == 0:
return nums1[k-1]

if (i > length_nums1-1 or nums1[i] >= nums2[j-1]) and (j > length_nums2- 1 or nums2[j] >= nums1[i-1]):
return max(nums1[i-1], nums2[j-1])
if nums1[i-1] > nums2[j-1]:
return findKthSortedArrays(k-j, nums1[:i], nums2[j:])
if nums2[j-1] > nums1[i-1]:
return findKthSortedArrays(k-i, nums1[i:], nums2[:j])

return 222
return findKthSortedArrays(int(ceil((len(nums1)+len(nums2))/2)), nums1, nums2)
``````

"""
sol = Solution()
print(sol.findMedianSortedArrays([1,1,3,4,5,8,9,60,78],[1,2,55,68,68,999,5776]))
"""

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.