先贴覆盖函数,后续更新。
int overlay(char * pattern, int len) { int i, half = len/2; do { for (i=0; i<half; i++) { if (pattern[i] != pattern[len-half+i]) break; } if (i == half) return half-1; } while (half--); return -1; }
时间: 2024-10-29 19:10:21
先贴覆盖函数,后续更新。
int overlay(char * pattern, int len) { int i, half = len/2; do { for (i=0; i<half; i++) { if (pattern[i] != pattern[len-half+i]) break; } if (i == half) return half-1; } while (half--); return -1; }