Skip to content

Commit

Permalink
66-9kyo-hwang
Browse files Browse the repository at this point in the history
  • Loading branch information
9kyo-hwang committed Sep 14, 2024
1 parent bf8edb7 commit 086f215
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions 9-kyo-hwang/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@
| 63์ฐจ์‹œ | 2024.9.3 | Binary Search | [๊ตฌ๊ฐ„ ๋‚˜๋ˆ„๊ธฐ2](https://www.acmicpc.net/problem/13397) | [#218](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/218) |
| 64์ฐจ์‹œ | 2024.9.8 | Binary Search | [์ง•๊ฒ€๋‹ค๋ฆฌ](https://school.programmers.co.kr/learn/courses/30/lessons/43236) | [#221](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/221) |
| 65์ฐจ์‹œ | 2024.9.11 | Greedy | [๋””ํŽœ์Šค ๊ฒŒ์ž„](https://school.programmers.co.kr/learn/courses/30/lessons/142085) | [#224](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/224) |
| 66์ฐจ์‹œ | 2024.9.14 | Sliding Window | [ํ• ์ธ ํ–‰์‚ฌ](https://school.programmers.co.kr/learn/courses/30/lessons/131127) | [#225](https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/225) |
35 changes: 35 additions & 0 deletions 9-kyo-hwang/Sliding Window/ํ• ์ธ ํ–‰์‚ฌ.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include <string>
#include <vector>
#include <unordered_map>

using namespace std;

int solution(vector<string> InWants, vector<int> InNumbers, vector<string> InDiscounts)
{
unordered_map<string, int> NumberbyWants;
for(int i = 0; i < 9; ++i)
{
NumberbyWants[InDiscounts[i]]++;
}

int Answer = 0;
for(int i = 9; i < InDiscounts.size(); ++i)
{
NumberbyWants[InDiscounts[i]]++;
bool Flag = true;

for(int j = 0; j < InWants.size(); ++j)
{
if(NumberbyWants[InWants[j]] != InNumbers[j])
{
Flag = false;
break;
}
}

Answer += Flag;
NumberbyWants[InDiscounts[i - 9]]--;
}

return Answer;
}

0 comments on commit 086f215

Please sign in to comment.