+ Reply to Thread
Results 1 to 2 of 2

Thread: first unique char in a string

  1. #1
    Surfer is offline Senior Member
    Join Date
    Mar 2010
    Posts
    321

    first unique char in a string

    Find the first unique char in an array of char.

  2. #2
    Krazy Guest
    solution in O(n).

    Take an array of 256 size, in the first iteration put count of each variable in the array.
    In the 2nd iteration, check count of each char in the array, whatever char whose count is 1, is the first unique char in the string.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Difference between char *a and char a[]
    By TopGun in forum Arrays and Pointers
    Replies: 1
    Last Post: 18th March 2010, 20:39
  2. Replies: 1
    Last Post: 18th July 2008, 14:04
  3. What is the difference between char *a and char a[]?
    By xadmin in forum Declarations and Initializations
    Replies: 0
    Last Post: 16th February 2008, 21:26

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts