A little bit of skill

  • 홈
  • GitHub
  • 태그
  • 방명록

Algorithm/프로그래머스 2

99클럽 코테 스터디 6일차 체육복

def solution(n, lost, reserve): # 여벌 체육복이 있지만 도난당한 학생을 제외 reserve_set = set(reserve) - set(lost) lost_set = set(lost) - set(reserve) # 체육복을 빌려주는 과정 for c in reserve_set: if c-1 in lost_set: lost_set.remove(c-1) elif c+1 in lost_set: lost_set.remove(c+1) # 최종적으로 체육복을 입을 수 있는 학생의 수 answer = n - len(lost_set) return answer 해설 set 함수와 remov..

Algorithm/프로그래머스 2024.06.05

99클럽 코테 스터디 1일차 TIL 938. Range Sum of BST

leetcode.com 938. Range Sum of BSThttps://leetcode.com/problems/range-sum-of-bst/description/     이진 검색 트리의 범위 합 이진 검색 트리의 루트 노드와 두 정수 low와 high가 주어질 때, 값이 [low, high] 범위에 포함되는 모든 노드의 값의 합을 반환하세요.  풀이)이진 트리 사용트리 전체를 순회하면서 val이 low, high의 사이 값인 경우 저장해서 sum을 구함class Solution: def rangeSumBST(self, root: Optional[TreeNode], low: int, high: int) -> int: res = [] def traversa..

Algorithm/프로그래머스 2024.05.30
이전
1
다음
더보기
프로필사진

A little bit of skill

運七技三 - 다가올 운칠을 위하여 기삼을 다지는 블로그

  • 분류 전체보기 (299)
    • TIL (51)
    • Spring (30)
    • Java 기초 문법 (12)
    • KPT (6)
    • Git (5)
    • Algorithm (4)
      • 백준 (45)
      • 프로그래머스 (2)
      • 릿코드 (28)
      • 자료구조 (4)
      • 기본 지식 (2)
      • 체계적인 알고리즘 학습공략 (1)
    • ComputerScience (38)
    • 기술면접 준비 (25)
    • Server (5)
    • SQL (1)
    • Basic (8)
    • Project (12)
      • 스파르타 코딩클럽 (0)
      • Buy me If you can (11)
      • ParkingService (1)
    • Mac (1)
    • Python (1)
    • Architecture (1)

Tag

99클럽, 장원님짱짱맨, 세상에이런일이, lombok, json, 개발자 취업, 항해99, java, Til, gradle, AOP, =, thymeleaf, Spring, 코딩테스트 준비,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/05   »
일 월 화 수 목 금 토
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

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

  • GitHub

티스토리툴바