낭중지추
  • 홈
  • 태그
  • 방명록
    • 전체 (36)
      • Development (35)
        • Git (0)
        • Nginx (1)
        • Docker (1)
        • Algorithm (2)
        • React (1)
        • Architecture (1)
        • Javascript & Typescript (3)
        • NestJS (5)
        • Computer Science (0)
        • Node (1)
        • Etc (3)
        • Sequelize (1)
        • TypeORM (1)
        • SQL (4)
        • MongoDB (2)
        • MySQL (3)
        • PostgreSQL (1)
        • Java (4)
        • Blockchain (1)
      • 투자 (1)
        • 주식 (1)
      • 생각정리 (0)
        • 도서 (0)
        • 끄적끄적 (0)
  • 글작성
  • 방명록
  • 환경설정
  • 메뉴 닫기
Development/Algorithm 검색 결과
2 개의 검색 결과가 있습니다.
Development/Algorithm

[Python] bisect 활용 예시

bisect는 이진탐색(binary search)일 때 유용하게 사용 가능하다 이진탐색이란 간단하게 정렬되어 있는 배열내에서 특정 값을 찾아내는 것이다. [1, 2, 3, 3, 3, 3, 4, 5, 6] 위와 같이 정렬된 배열이 존재할 때 3 의 갯수를 구하고 싶으면 bisect를 활용하면 된다. def count_by_sorted_array(array, left_value, right_value): right_index = bisect_right(array, right_value) left_index = bisect_left(array, left_value) return right_index - left_index bisect_left(literable, value) : 왼쪽 인덱스를 구하기 bise..

2022. 3. 20. 17:08
Development/Algorithm

[Python] 기초 알고리즘 팀 노트 정리

방향 전환 def turn(direction, c): # 0 -> 3 # 1 -> 0 # 2 -> 1 # 3 -> 2 # 서쪽 방향으로 회전 if c == "L": direction = (direction - 1) % 4 # 0 -> 1 # 1 -> 2 # 2 -> 3 # 3 -> 0 # 동쪽 방향으로 회전 if c == "D": direction = (direction + 1) % 4 return direction turn(0, "L") turn(3, "D") 2차원 배열 90도 회전 # a는 2차원 배열이어야 함. def rotate_a_matrix_by_90_degree(a): return list(zip(*a[::-1])) rotate_a_matrix_by_90_degree([[0, 1, 0], ..

2022. 2. 10. 19:16
  • «
  • 1
  • »

공지사항

전체 카테고리

  • 전체 (36)
    • Development (35)
      • Git (0)
      • Nginx (1)
      • Docker (1)
      • Algorithm (2)
      • React (1)
      • Architecture (1)
      • Javascript & Typescript (3)
      • NestJS (5)
      • Computer Science (0)
      • Node (1)
      • Etc (3)
      • Sequelize (1)
      • TypeORM (1)
      • SQL (4)
      • MongoDB (2)
      • MySQL (3)
      • PostgreSQL (1)
      • Java (4)
      • Blockchain (1)
    • 투자 (1)
      • 주식 (1)
    • 생각정리 (0)
      • 도서 (0)
      • 끄적끄적 (0)
  • 최근 글
  • 최근 댓글

최근 글

최근댓글

태그

  • #solid
  • #typeorm
  • #NestJS
  • #객체지향
  • #Spring
  • #Big Sur
  • #OOP
  • #TypeScript
  • #Migration
  • #MySQL
더보기+

전체 방문자

오늘
어제
전체

블로그 인기글

Powered by Privatenote/라이프코리아 Copyright © 낭중지추 All rights reserved. TistoryWhaleSkin3.4

티스토리툴바