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

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

Share

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

This article introduces the knowledge of "how to find the median of two positive ordinal arrays". Many people will encounter this dilemma in the operation of actual cases. next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Search for the median description of two positive ordinal arrays

Difficulty: difficulty

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

Example 1:

Input: nums1 = [1p3], nums2 = [2] output: 2.00000 explain: merge array = [1mem2p3], median 2

Example 2:

Input: nums1 = [1jue 2], nums2 = [3jue 4] output: 2.50000 explain: merge array = [1Jing 2 Jing 3 Jing 4], median (2 + 3) / 2 = 2.50000

Example 3:

Input: nums1 = [0jue 0], nums2 = [0je 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 = = mnums2.length = = n0

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

Development

Wechat

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

12
Report