<commit_before>// There are two sorted arrays nums1 and nums2 of size m and n respectively.
// Find the median of the two sorted arrays.
// The overall run time complexity should be O(log (m+n)).


var findMedianSortedArrays = function(nums1, nums2) {
    function median(values) {
        values.sort( function(a,b) {return a - b;} );
        var half = Math.floor(values.length/2);
        if(values.length % 2)
            return values[half];
        else
            return (values[half-1] + values[half]) / 2.0;
    }
    return median(nums1.concat(nums2));
};<commit_msg>add logic<commit_after>// There are two sorted arrays nums1 and nums2 of size m and n respectively.
// Find the median of the two sorted arrays.
// The overall run time complexity should be O(log (m+n)).



// Logic

// create a function called median that takes values
  // sort these values
  // create a var called half by
    // set half by grabbing length of values dividing it by half and rounding it
  // if length of values is even return that item
  // else return the half index and the item before it, add them and divide it by 2
// call the median function on the two given arrays comboned or concat'd


var findMedianSortedArrays = function(nums1, nums2) {
    function median(values) {
        values.sort( function(a,b) {return a - b;} );
        var half = Math.floor(values.length/2);
        if(values.length % 2)
            return values[half];
        else
            return (values[half-1] + values[half]) / 2.0;
    }
    median(nums1.concat(nums2));
};
{'fraction_non_alphanumeric': 0.10160771704180065, 'fraction_numerical': 0.014790996784565916, 'mean_word_length': 2.6440281030444965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '244775', 'n_tokens_mistral': 470, 'n_tokens_neox': 457, 'n_words': 184}