개발45 [BOJ | Python] 3344 N-Queen 백준 3344 N-Queenhttps://www.acmicpc.net/problem/3344 시도 1 : 백트래킹 (실패)백트래킹 예제 풀다가 변형해서 제출했는데 N 최대가 99999라서 시간 초과가나온다. N = int(input())ans = []for i in range(0, N): ans.append(-1)def queen(num): if check(num) == True: if num == N: for a in ans: print(a+1) exit(0) else: for j in range(0, N): ans[num] = j .. 2024. 12. 12. [프로그래머스] lv.1 개인정보 수집 유효기간 https://school.programmers.co.kr/learn/courses/30/lessons/150370# 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 내 풀이 def solution(today, terms, privacies): answer = [] today_int = int(today[0:4])*10000 + int(today[5:7])*100 + int(today[8:10]) terms_dict = {} for term in terms: tmp = term.split() terms_dict[tmp[0]] = int(tmp[1]) for.. 2024. 2. 12. [프로그래머스] lv2. 순위 검색 https://school.programmers.co.kr/learn/courses/30/lessons/72412 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 내 풀이 import re def remove_etc(str_list): removed_list = [re.sub(r'and ', '', x) for x in str_list] return removed_list def solution(info, query): answer = [] info = (remove_etc(info)) info = [x.split() for x in info] query .. 2024. 2. 12. [프로그래머스] lv.1 가장 많이 받은 선물 https://school.programmers.co.kr/learn/courses/30/lessons/258712?language=python3 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 내 코드 def solution(friends, gifts): # {{이름:인덱스}, {이름:인덱스}} index={} for i in range(0, len(friends)): index[friends[i]] = i # 주고 받은 선물 arr = [[0 for j in range(len(gifts))] for i in range(len(gifts))] for gi.. 2024. 1. 29. [프로그래머스] lv.2 과제 진행하기 https://school.programmers.co.kr/learn/courses/30/lessons/176962 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 나의 풀이 from collections import deque def solution(plans): # 리스트 시간순 정렬 plans.sort(key=lambda x:x[1]) # 시간을 숫자로 변환 및 타입 변경 for i in range(len(plans)): h, m = plans[i][1].split(':') plans[i][1] = int(h)*60+int(m) plans[i][2] .. 2024. 1. 28. 이전 1 2 3 4 ··· 9 다음