Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report