전체 글
-
6. 스택코딩테스트 2024. 3. 20. 23:20
컨트롤 제트 - https://school.programmers.co.kr/tryouts/85926/challenges 리스트에서 pop과 append로 스택 구현 가능 def solution(s): answer = 0 stack = [] s_list = s.split(" ") for item in s_list: if item == "Z": stack.pop() else: stack.append(int(item)) return sum(stack) 같은 숫자는 싫어 - https://school.programmers.co.kr/tryouts/85927/challenges 직전 숫자만 기억 def solution(arr): ans = [] before = -1 for num in arr: if num != ..
-
5. 셋(집합)코딩테스트 2024. 3. 20. 23:07
외계어 사전 - https://school.programmers.co.kr/tryouts/85920/challenges def solution(spell, dic): answer = 0 for item in dic: check = True for c in spell: if c not in item: check = False break if check: return 1 return 2 중복된 문자 제거 - https://school.programmers.co.kr/tryouts/85921/challenges def solution(my_string): ans = "" table = set() for c in my_string: if c not in table: ans += c table.add(c) ret..
-
4. 딕셔너리(해시맵)코딩테스트 2024. 3. 20. 00:30
로그인 성공? - https://school.programmers.co.kr/tryouts/85912/challenges dict 메소드 활용해서 리스트를 변환한 후 해결 def solution(id_pw, db): hash_db = dict(db) if id_pw[0] in hash_db: ans = "login" if hash_db[id_pw[0]] == id_pw[1] else "wrong pw" else: ans = "fail" return ans 성격 유형 검사하기 - https://school.programmers.co.kr/tryouts/85913/challenges zip으로 묶어서 비교하는게 포인트 def solution(survey, choices): check = "RTCFJMAN" ..
-
3. 배열/리스트코딩테스트 2024. 3. 18. 23:41
잘라서 배열로 저장하기 - https://school.programmers.co.kr/tryouts/85905/challenges 간단한 한줄 문제 def solution(my_str, n): return [my_str[start:start+n] for start in range(0, len(my_str), n)] 2차원으로 만들기 - https://school.programmers.co.kr/tryouts/85906/challenges 위와 동일한 문제 def solution(num_list, n): return [num_list[start:start+n] for start in range(0, len(num_list), n)] 7의 개수 - https://school.programmers.co.kr/..
-
2. 구현코딩테스트 2024. 3. 18. 23:16
연습) 가위 바위 보 - https://school.programmers.co.kr/tryouts/85898/challenges 각 case를 이기는 값을 key-value 쌍으로 묶어주어서 간단하게 해결 def solution(rsp): answer = '' ans_dic = {"2":"0", "0":"5", "5":"2"} # 가위=바위, 바위=보, 보=가위 for c in rsp: answer += ans_dic[c] return answer 연속된 수의 합 - https://school.programmers.co.kr/tryouts/85899/challenges 홀수 짝수 나누는게 포인트 def solution(num, total): if num % 2 == 0: # 짝수 start = int(t..
-
SWeetMe Project - 회원가입, 로그인 기능프로젝트 2024. 3. 18. 22:15
SWeetMe Project에서 회원 기능을 구현하기 위해 Firebase Authentication API를 활용하였습니다. Firebase Authentication은 사용자 인증과 로그인 기능을 지원하는게 대표적인데요. 이외에도 익명 로그인, 이메일 인증, 전화번호 인증 등도 지원하고 있으며, 소셜 로그인을 통한 인증도 지원합니다. 해당 API를 활용하면 회원가입, 로그인, 로그아웃 등을 간편하게 구현할 수 있으며, Firebase의 강력한 기능 중 하나인 Firestore 데이터 베이스를 사용할 경우 보안 규칙의 기준이 되는 key인 uid를 해당 API를 통해 생성 및 관리할 수 있습니다. 추가적으로 카카오나 네이버 등의 소셜 로그인은 OAuth2(Open Authorization 2.0) 프로..
-
SWeetMe Project - FireStore 보안 규칙프로젝트 2024. 3. 18. 22:07
파이어스토어 기능을 추가할 때 테스트 모드로 시작하면 한 달 정도 읽기, 쓰기가 가능하도록 보안 규칙이 자동 설정이 된다. 개발할 때는 당장 신경쓸 필요가 없지만, 따로 보안 규칙을 설정하지 않으면 데이터베이스가 보호되지 않기 때문에 보안 규칙 적용이 꼭 필요하다. 보안 규칙을 수정하면서 공부했던 내용을 정리해보았다. FireStore의 보안 규칙은 커스텀 언어를 활용한다. CEL(Common Expression Language) 기반 언어이며, match와 allow를 사용해 조건부 액세스 권한을 부여한다. - 보안 규칙 언어 rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /{docu..
-