<file_sep>class Solution(object):
    def findMedianSortedArrays(self, nums1, nums2):
        """
        :type nums1: List[int]
        :type nums2: List[int]
        :rtype: float
        """
        for i in nums2:
            nums1.append(i)
        nums1.sort()
        k=len(nums1)
        if k%2==0:
            return (float(nums1[int(k/2-1)])+nums1[int(k/2)])/2
        else:
            return nums1[int((k-1)/2)]<file_sep>class Solution {
public:
    int reverse(int x) {
        long long tmp = abs((long long)x);
        long long ret = 0;
        while (tmp) {
            ret = ret * 10 + tmp % 10;
            if (ret > INT_MAX)
                return 0;
            tmp /= 10;
        }
        if (x > 0)
            return (int)ret;
        else
            return (int)-ret;
    }
};
<file_sep>class Solution {
public:
   string reverseWords(string s) {
        
        auto iter = s.begin();
        auto last = s.begin();
        do{
            
            last = std::find(iter, s.end(), ' ');
            std::reverse(iter, last);
    
        }while((iter = last)++ != s.end());
    return s;
}
};