Finding common characters in two strings

前端 未结 13 2597
终归单人心
终归单人心 2020-12-15 14:09

I am coding for the problem in which we got to count the number of common characters in two strings. Main part of the count goes like this

for(i=0; i < st         


        
13条回答
  •  长情又很酷
    2020-12-15 14:38

    You can do it with 2n:

    int i,j, len1 = strlen(s1), len2 = strlen(s2);
    unsigned char allChars[256] = { 0 };
    int count = 0;
    
    for( i=0; i

提交回复
热议问题