1.3k1 分钟

#include <stdio.h> #include <stdlib.h> #include <string.h> void nex(char *s, int *next) { next[0] = 0; int now = 0, x = 1; while (x < strlen(s)) { if (s[now] == s[x]) { now += 1;
5141 分钟

再次验证我菜 bool isPalindrome(char * s){ char strss[500000]; int x=0,y=0; while(x< strlen(s)){ if((s[x]>='a'&&s[x]<='z')||(s[x]>='0'&&s[x]<='9')) strss[y]=s[x]; else if (s[x]>&#x
3641 分钟

int searchInsert(int* nums, int numsSize, int target){ if(numsSize ==1){ if(target<=nums[0]) return 0; return 1; } int left=0 , right= numsSize,mid =numsSize/2; while(right-left>1){ if(target>=nums[mid])
2511 分钟

int lengthOfLastWord(char * s){ if(strlen(s) == 0) return 0; int x =strlen(s)-1; while(s[x]==' '){ x-=1; if(x<0) return 0; } int j = 0; while(s[x]!= ' '){ x-=1; j+=1; if(x<0)
6011 分钟

int strStr(char * haystack, char * needle){ if(strlen(needle) == 0) return 0; if(strlen(haystack) ==0||strlen(haystack) <strlen(needle)) return -1; int x=0,y=0,sta=0; while(x <=strlen(haystack)-strlen(needle)){ if(haystack[x] ==