#ifndef S0004_MEDIAN_OF_TWO_SORTED_ARRAYS_HPP #define S0004_MEDIAN_OF_TWO_SORTED_ARRAYS_HPP #include using namespace std; class S0004 { 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& nums1, std::vector& nums2); int getKthElement(const std::vector& nums1, const std::vector& nums2, int k); }; #endif