DEV Community

Cover image for Problem Solving for Developers - JavaScript [Arrays, Searching].
Dreamy Developer
Dreamy Developer

Posted on • Updated on

Problem Solving for Developers - JavaScript [Arrays, Searching].

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).
 */
Enter fullscreen mode Exit fullscreen mode

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.

highlighted Comments showing 40% responded "Yes", 50% responded "No" and 10% responded "Not sure"

Check the tutorial for Solution

Top comments (0)