Skip to content

Commit

Permalink
1119 added.
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyubobobo committed Jul 14, 2019
1 parent d1643a3 commit a098eb1
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
6 changes: 6 additions & 0 deletions 1119-Remove-Vowels-from-a-String/cpp-1119/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.14)
project(B)

set(CMAKE_CXX_STANDARD 14)

add_executable(B main.cpp)
31 changes: 31 additions & 0 deletions 1119-Remove-Vowels-from-a-String/cpp-1119/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/// Source : https://leetcode.com/problems/remove-vowels-from-a-string/
/// Author : liuyubobobo
/// Time : 2019-07-13

#include <iostream>
#include <unordered_set>

using namespace std;


/// Linear Scan
/// Time Complexity: O(n)
/// Space Complexity: O(1)
class Solution {
public:
string removeVowels(string S) {

unordered_set<char> vowels = {'a', 'e', 'i', 'o', 'u'};
string res = "";
for(char c: S)
if(!vowels.count(c))
res += c;
return res;
}
};


int main() {

return 0;
}
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -763,4 +763,5 @@ email: [[email protected]](mailto:[email protected])
| 1111 | [Maximum Nesting Depth of Two Valid Parentheses Strings](https://leetcode.com/problems/maximum-nesting-depth-of-two-valid-parentheses-strings/) | [] | [C++](1111-Maximum-Nesting-Depth-of-Two-Valid-Parentheses-Strings/cpp-1111/) | | |
| | | | | | |
| 1118 | [Number of Days in a Month](https://leetcode.com/problems/number-of-days-in-a-month/) | [] | [C++](1118-Number-of-Days-in-a-Month/cpp-1118/) | | |
| | | | | | |
| 1119 | [Remove Vowels from a String](https://leetcode.com/problems/remove-vowels-from-a-string/) | [] | [C++](1119-Remove-Vowels-from-a-String/cpp-1119/) | | |
| | | | | | |

0 comments on commit a098eb1

Please sign in to comment.