-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ✨feat: 8월16일 프로그래머스 문제 풀이 * ✨feat: 8월25일 PGS 문제 풀이 오늘은 힐링 느낌으로 풀이했습니다! * ✨feat: 8월30일 프로그래머스 문제 풀이
- Loading branch information
1 parent
cfec058
commit d1a28aa
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
def solution(sticker): | ||
answer01 = [] | ||
answer02 = [] | ||
|
||
answer01.append(0) | ||
answer02.append(sticker[0]) | ||
|
||
if len(sticker) > 1: | ||
answer01.append(sticker[1]) | ||
answer02.append(sticker[0]) | ||
|
||
for i in range(2, len(sticker)): | ||
answer01.append(max(answer01[i - 1], answer01[i - 2] + sticker[i])) | ||
answer02.append(max(answer02[i - 1], answer02[i - 2] + sticker[i])) | ||
|
||
if len(sticker) == 1: | ||
return sticker[0] | ||
return max(answer01[len(sticker) - 1], answer02[len(sticker) - 2]) | ||
|
||
|
||
print(solution([14, 6, 5, 11, 3, 9, 2, 10])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
def solution(record): | ||
answer = [] | ||
|
||
userDic = {} | ||
recordChet = [] | ||
for x in record: | ||
temp = x.split(" ") | ||
if temp[0] == "Enter" or temp[0] == "Leave": | ||
recordChet.append((temp[0], temp[1])) | ||
if temp[0] != "Leave": | ||
userDic[temp[1]] = temp[2] | ||
|
||
for y in recordChet: | ||
tempStr = userDic[y[1]] + "님이 " | ||
if y[0] == "Enter": | ||
answer.append(tempStr + "들어왔습니다.") | ||
else: | ||
answer.append(tempStr + "나갔습니다.") | ||
|
||
return answer | ||
|
||
|
||
print(solution( | ||
["Enter uid1234 Muzi", "Enter uid4567 Prodo", "Leave uid1234", "Enter uid1234 Prodo", "Change uid4567 Ryan"])) | ||
|