From 5f87bcd5d439c89c7ad9a0abaf40ed51539bafd0 Mon Sep 17 00:00:00 2001 From: Manu Gond Date: Wed, 2 Oct 2019 14:37:54 +0530 Subject: [PATCH] added median of two sorted arrays --- leetcode/README.md | 1 + leetcode/src/4.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 leetcode/src/4.c diff --git a/leetcode/README.md b/leetcode/README.md index 155d3f37..05732280 100644 --- a/leetcode/README.md +++ b/leetcode/README.md @@ -7,6 +7,7 @@ LeetCode | # | Title | Solution | Difficulty | |---| ----- | -------- | ---------- | |3|[Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/) | [C](./src/3.c)|Medium| +|4|[Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays/) | [C](./src/4/c)|Hard| |20|[Valid Parentheses](https://leetcode.com/problems/valid-parentheses/) | [C](./src/20.c)|Easy| |27|[Remove Element](https://leetcode.com/problems/remove-element/) | [C](./src/27.c)|Easy| |24|[Swap Nodes in Pairs](https://leetcode.com/problems/swap-nodes-in-pairs/) | [C](./src/24.c)|Medium| diff --git a/leetcode/src/4.c b/leetcode/src/4.c new file mode 100644 index 00000000..b5a2e830 --- /dev/null +++ b/leetcode/src/4.c @@ -0,0 +1,40 @@ + + +double findMedianSortedArrays(int* nums1, int nums1Size, int* nums2, int nums2Size){ + int index1=0; + int index2=0; + int v[nums1Size+nums2Size]; + int v_index=0; + + while(index1