Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing question statement #4022

Closed
1 of 4 tasks
Mohitkumar6122 opened this issue Jul 2, 2021 · 2 comments
Closed
1 of 4 tasks

Confusing question statement #4022

Mohitkumar6122 opened this issue Jul 2, 2021 · 2 comments

Comments

@Mohitkumar6122
Copy link

Your LeetCode username

MohitKumar6122

Category of the bug

  • Question
  • Solution
  • Language
  • Missing Test Cases

Description of the bug

In the question #387 statement it is written as

return the first non-repeating character in it and return its index.

instead this should be written as

find the first non-repeating character in it and return its index.

Code you used for Submit/Run operation

class Solution {
public:
    int firstUniqChar(string s) {
        vector<pair<int, int>> freq(26, pair<int, int > (0, 0)) ;
        for(int i = 0 ; i < s.size(); ++i){
            freq[s[i] - 'a'].first++ ;
            freq[s[i] - 'a'].second = i ;
        }
        int ans = INT_MAX ;
        for(int i = 0; i < 26; ++i){
            if (freq[i].first == 1) ans = min(ans , freq[i].second) ;
        }
        return ans == INT_MAX ? -1 : ans  ; 
    }
};

Language used for code

C++

Expected behavior

Screenshots

Additional context

@lc-kay
Copy link

lc-kay commented Jul 2, 2021

Hi @Mohitkumar6122
Thank you for reaching out to us. I've relayed this issue to our team to investigate.

@Mohitkumar6122
Copy link
Author

Welcome @lc-kay for addressing this issue.
I think we can close this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants