We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0d8c75a commit 9c38b83Copy full SHA for 9c38b83
dart/0004-median-of-two-sorted-arrays.dart
@@ -1,16 +1,13 @@
1
class Solution {
2
double findMedianSortedArrays(List<int> nums1, List<int> nums2) {
3
- List<int>list=nums1+nums2;
+ List<int>list = nums1 + nums2;
4
5
list.sort();
6
- int index= list.length~/2;
7
- bool isodd=(list.length & 0x01) != 0;
8
- if(!isodd){
9
- return (list[index]+list[index-1])/2;
+ int index = list.length ~/ 2;
+ bool isodd = (list.length & 0x01) != 0;
+ if (!isodd) {
+ return (list[index] + list[index - 1]) / 2;
10
}
11
- else
12
return double.parse(list[index].toString());
13
-
14
15
16
-}
+}
0 commit comments