Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to find the median of two positive ordinal arrays in LeetCode

Shulou Source: shulou.com Published: 2022-06-02 05:28:22 10月03日 Update

This article will explain in detail how to find the median of two positive ordinal arrays in LeetCode. The content of the article is of high quality, so the editor shares it for you to do a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

First, find the median of two positive ordinal arrays 1.1, a brief description of the problem

Given two positive order (from small to large) arrays nums1 and nums2 of sizes m and n. Please find out and return the median of these two positive ordinal arrays.

1.2, example 1:

Input: nums1 = [1prime3], nums2 = [2]

Output: 2.00000

Explanation: merge array = [1, 2, 2, 3], median 2

Example 2:

Input: nums1 = [1jue 2], nums2 = [3pr 4]

Output: 2.50000

Explanation: merged array = [1, 2, 4, 3], median (2 + 3) / 2 = 2.5

Example 3:

Input: nums1 = [0jue 0], nums2 = [0jue 0]

Output: 0.00000

Example 4:

Input: nums1 = [], nums2 = [1]

Output: 1.00000

Example 5:

Input: nums1 = [2], nums2 = []

Output: 2.00000

Tip:

Nums1.length = = m

Nums2.length = = n

0

Tags: Median array example two input output content size ideas articles more knowledge articles solutions explanations yes from small to big from small to big that is this topic Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Information Apple Shulou Technology Huawei