Median of Two Sorted Arrays
This commit is contained in:
26
include/s0004_median_of_two_sorted_arrays.hpp
Normal file
26
include/s0004_median_of_two_sorted_arrays.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef S0004_MEDIAN_OF_TWO_SORTED_ARRAYS
|
||||
#define S0004_MEDIAN_OF_TWO_SORTED_ARRAYS
|
||||
|
||||
#include <vector>
|
||||
|
||||
class Solution {
|
||||
public:
|
||||
/**
|
||||
* @brief Median of Two Sorted Arrays
|
||||
*
|
||||
* Given two sorted arrays `nums1` and `nums2` of size `m` and `n`
|
||||
* respectively, return the median of the two sorted arrays.
|
||||
*
|
||||
* The overall run time complexity should be `O(log(m+n))`.
|
||||
*
|
||||
* @param nums1 the first sorted array
|
||||
* @param nums2 the second sorted array
|
||||
* @return the median of the two sorted arrays
|
||||
*/
|
||||
double findMedianSortedArrays(std::vector<int>& nums1,
|
||||
std::vector<int>& nums2);
|
||||
int getKthElement(const std::vector<int>& nums1,
|
||||
const std::vector<int>& nums2, int k);
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user