DEV Community 👩‍💻👨‍💻

Miss Pooja Anilkumar Patel
Miss Pooja Anilkumar Patel

Posted on • Updated on

387. Leetcode Solution in CPP

class Solution {
  int firstUniqChar(string s) {
    vector<int> count(128);

    for (const char c : s)

    for (int i = 0; i < s.length(); ++i)
      if (count[s[i]] == 1)
        return i;

    return -1;

Enter fullscreen mode Exit fullscreen mode



Here is the link for the problem:

Top comments (0)

🌚 Turn on dark mode

🔠 Change your default font

📚 Adjust your experience level to see more relevant content


Head to your account's Settings to do all this and more.