/* @author: Yihao Yan Link(LCP.zip): http://fm2012.verifythis.org/challenges Longest Common Prefix (LCP) Input: an integer array X1[n], and two indices x and y into this array Output: length of the longest common prefix of the subarrays of a starting at x and y respectively. */ #include $input int N_BOUND=4; $input int n; $input int x; $input int y; $input int X1[n]; $assume (x < n && y < n && x >=0 && y>=0 && n > 0 && n <= N_BOUND); int lcp(int *arr, int n, int x, int y){ int l=0; while (x+l y ? x : y; if(result + maxXY < n){ $assert(X1[x+result] != X1[y+result]); } }