Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Serialization
- s
- C 언어 코딩 도장
- coding test
- 윤성우의 열혈 자료구조
- insertion sort
- 이것이 자바다
- stream
- Algorithm
- buffer
- datastructure
- 혼자 공부하는 C언어
- 메모리구조
- C programming
- 윤성우 열혈자료구조
- 이스케이프 문자
- 알기쉬운 알고리즘
- list 컬렉션
- JSON
- Selection Sorting
- Graph
- Stack
- R
Archives
- Today
- Total
Engineering Note
네이버부스트캠프 본문
it 취업을 위한 알고리즘 문제 풀이
문제
코드
import string
def solution(param0):
answer = []
fileList = []
for paramElem in param0:
paramList = paramElem.split("/") # 파일명 구하기 위해 /로 문자열 구분 리스트에 저장
fileList.append(paramList[-1][0]+"."+paramList[-1][-1]) # 구분된 문자열을 저장한 리스트에서 마지막 인덱스가 파일명, 그리고 그 파일명에서 버전 정보 제외한 파일명 추출
# file로만 구성된 리스트에서 같은 파일 값 찾기
fileListSize = len(fileList)
for i in range(fileListSize):
cnt = 1
for j in range(i+1,fileListSize):
if fileList[i] == fileList[j]: #같은 파일명 찾으면 카운트값 1 증가
cnt += 1
if cnt != 1 and fileList[i] not in answer: # 동일한 파일명이 존재여부 및 중복 검사
answer.append(fileList[i])
answer.append(str(cnt))
문제해결방법
'Problem Solving' 카테고리의 다른 글
알고리즘 문제 풀이 사고 과정 (0) | 2021.05.14 |
---|---|
나머지 한점 (0) | 2021.04.23 |
Comments