题目描写叙述: Write a function to find the longest common prefix string amongst an array of strings.就是给定1个字符串数组,找出公共最长前缀. 思路非常直接.使用1个索引来存最长公共前缀的长度就能够了. 注意, 假设使用1个字符串变量来存前缀的话,是不能AC的,由于题目不同意使用额外的空间. public string LongestCommonPrefix(string[] strs) { if(strs
unsigned int str_num(char *str[], int num[], int len) { int i, j; int count; int flag[len]; ; i < len; i++) { num[i] = ; flag[i] = ; } ; i < len; i ++) { ; j <= len; j ++) { == flag[i])&& ( == strncmp(str[j], str[i], strlen(str[j]) > s
Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] inclusive that do not appear in this array. Could you do it without extra space and in O(n) runtime?