We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2f00995 commit 724aff7Copy full SHA for 724aff7
lcof/面试题50. 第一个只出现一次的字符/README.md
@@ -83,6 +83,26 @@ var firstUniqChar = function (s) {
83
};
84
```
85
86
+### **C++**
87
+
88
+```cpp
89
+class Solution {
90
+public:
91
+ char firstUniqChar(string s) {
92
+ unordered_map<char, bool> um;
93
+ for (char c : s) {
94
+ um[c] = um.find(c) == um.end();
95
+ }
96
97
+ if (um[c]) {
98
+ return c;
99
100
101
+ return ' ';
102
103
+};
104
+```
105
106
### **...**
107
108
lcof/面试题50. 第一个只出现一次的字符/Solution.cpp
@@ -0,0 +1,15 @@
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0 commit comments