This content originally appeared on DEV Community and was authored by Dreamy Developer
Hey everyone,
I'm Dreamy and today we're gonna solve a problem in JavaScript.
And today's type of Problem is - Arrays and Searching.
/**
* Given two sorted arrays array1 and array2 of size m and n respectively.
* Find the median of the two sorted arrays.
*
* @Example 1:
* Input:
* m = 3, n = 4
* array1 = [1, 9, 15]
* array2 = [2, 4, 5, 23]
*
* Output: 5
*
* @Example 2:
* Input:
* m = 2, n = 4
* array1 = [41, 78]
* array2 = [3, 4, 7, 8]
*
* Output: 7.5
*
* Expected Time Complexity: O(min(log n, log m)).
* Expected Auxiliary Space: O((n+m)/2).
*/
Have a bit of a coding yourself and see what kind of solution you can come up with and comment your solution here.
You can write your solution in any language and in your way, But don't forget to comment your best solution here.
If you get stuck or you want to see the solution,
II'l show you how would i solve it.
We will Highlight top answers || comments in Future videos.
Check the tutorial for Solution
This content originally appeared on DEV Community and was authored by Dreamy Developer
Dreamy Developer | Sciencx (2022-02-05T07:15:04+00:00) Problem Solving for Developers – JavaScript [Arrays, Searching].. Retrieved from https://www.scien.cx/2022/02/05/problem-solving-for-developers-javascript-arrays-searching/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.