We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b9cd157 commit 509dedaCopy full SHA for 509deda
βsolution/0004.Median of Two Sorted Arrays/Solution.py
@@ -0,0 +1,12 @@
1
+class Solution:
2
+ def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float:
3
+ # concatenate the 2 lists and sort them
4
+ nums1 += nums2
5
+ nums1.sort()
6
+ length = len(nums1)
7
+ value = length/2
8
+ if length % 2 == 0:
9
+ value = int(value)
10
+ return (nums1[value-1] + nums1[value])/2
11
+ else:
12
+ return nums1[int(value)]
βsolution/README.md
@@ -32,6 +32,7 @@
32
βΒ Β βββ Solution.go
33
βΒ Β βββ Solution.java
34
βΒ Β βββ Solution.js
35
+βΒ Β βββ Solution.py
36
βββ 0005.Longest Palindromic Substring
37
βΒ Β βββ README.md
38
0 commit comments