Skip to content

Commit 9f05be8

Browse files
correct space complexity and simple code
1 parent 7ed10fd commit 9f05be8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Ransom Note - Leetcode 383/Ransom Note - Leetcode 383.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#include <unordered_map>
22
#include <string>
3+
using namespace std;
34

45
class Solution {
56
public:
6-
bool canConstruct(std::string ransomNote, std::string magazine) {
7-
std::unordered_map<char, int> hashmap;
7+
bool canConstruct(string ransomNote, string magazine) {
8+
unordered_map<char, int> hashmap;
89

910
for (char ch : magazine) {
1011
hashmap[ch]++;

0 commit comments

Comments
 (0)