Leetcode_4:
Class Solution {public: double findmediansortedarrays (int a[], int m, int b[], int n) { int len = m+n; if (len & 1) { return My_find (A,m,b,n, (Len >> 1) +1); } else { return (double (My_find (A,m,b,n,len & Gt;> 1) + My_find (A,m,b,n, (Len >> 1) +1))/2;} } Double my_find (int a[], int m, int b[], int n, int k) { if (m>n) return My_find (b,n,a,m,k); if (m==0) return b[k-1]; if (k==1) return a[0]<b[0]? A[0]:B[0]; int ma = k/2<m?k/2:m; int mb = K-MA; if (A[ma-1]==b[mb-1]) return a[ma-1]; if (A[ma-1]<b[mb-1]) return My_find (A+ma, M-ma, B, MB, k-ma); else return My_find (A, MA, B+MB, N-MB, K-MB);} ;
LEETCODE_10:
Class Solution {public: bool IsMatch (const char *s, const char *p) { if (*s== ' && *p== ') return True ; else if (*s!= ' | | | *p!= ') { if (*p== ') return false; if (* (p+1) = = ' * ') { if (IsMatch (s,p+2)) return true;if ((*s!= ') && (*p== '. ' | | *s==*p)) return IsMatch (s+1,p ); return false; } else{ if ((*s!= ') && (*p== '. ' | | *s==*p)) return IsMatch (s+1,p+1); return false; }} else return false;}};
Empty of strange deserted! Sticker Code Bar ~