top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Find first not-repeating character by iterating through the length of the string only once preferably C/C++/Java?

0 votes
313 views
Find first not-repeating character by iterating through the length of the string only once preferably C/C++/Java?
posted Oct 28, 2016 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
0 votes

Find the first non repeating character in a string.

For example
Input string: "abcdeabc"
Output: "e"

+6 votes

For example: It returns ‘b’ when the input is “abaccdeff”.

0 votes

Write the prototype function in C: char * my_strchr (char * arr, char c);

The function should return the cursor to the first occurrence of the forwarded character in the character sequence or NULL if the forwarded character was not found.

i came up with solution also but it has to be string :

char *my_strchr(char *arr,char c)
{
int i=0;
char *p;
while(1)
{
if(i[arr] == c){p = i[arr];return p;break;}
if(i[arr] == '\0'){p= NULL;return p;break;}
i++;
}}

+1 vote

Consider an implementation of Strings consisting of an array where the first element of the array indicates the length of the String and the next elements represent the value of the ASCII characters in the String.
Implement String concatenation of such scenario using C?

...