Category: Basic

Implement strstr function in Java

Write an efficient algorithm to implement strstr function in Java which returns the index of first occurrence of a string in another string.

Implement substr function in C

Write an efficient function to implement substr function in C. substr() function returns the substring of given string between two given indexes.

Implement strcmp() function in C

Write an efficient function to implement strcmp function in C. Standard strcmp() function compares the two strings and returns an integer indicating the relationship between the two strings.

Implement strncat() function in C

Write an efficient function to implement strncat function in C. Standard strncat() function appends appends first num characters of given C-string to the another string.

Implement strcat() function in C

Write an efficient function to implement strcat function in C. Standard strcat() function appends a copy of the given C-string to the another string.

Implement substring function in C

Write an efficient function to implement substring function in C. substring() function returns the substring of given string containing n characters starting from given index.

Implement strncpy() function in C

Write an efficient function to implement strncpy function in C. Standard strncpy() function copy given n characters from source C-string to another string.