말하는대로

  • 홈
  • 태그
  • 방명록

zip 1

[Leetcode] 1528. Shuffle String

Problem 이번 문제는 s 라는 문자열이 주어지고 indices에 s 문자열 각자리의 알맞는 인덱스가 들어가있고 정렬해서 return 해주는 문제이다. 나의 풀이 class Solution: def restoreString(self, s: str, indices: List[int]) -> str: res = '' zipped = sorted(zip(indices, s), key=lambda x: x[0]) for idx,char in zipped: res += char return res zip으로 두개를 묶고 , 인덱스를 기준으로 정렬한 뒤에 res에 더해주고 return 해 주었어용 다른 사람의 풀이 두가지를 보자 class Solution: def restoreString(self, s: str..

Python/algorithm 2023.01.12
이전
1
다음
더보기
반응형
프로필사진

말하는대로

순간을 후회로 남지않게

  • 분류 전체보기 (78)
    • Python (53)
      • Django (3)
      • algorithm (38)
      • FastAPI (0)
      • core (2)
    • AI (1)
    • Data (3)
    • CS (7)
      • Network (1)
      • 운영체제 (1)
    • Infra (2)
      • GCP (1)
      • CICD (0)
    • etc (3)
    • App (2)
      • Android (1)
      • iOS (1)
      • etc (0)
    • gekco (1)
    • LostArk (0)
    • DesignPattern (1)
    • Project (1)
      • QnA_With_Your_Sentiment (1)
    • Devops (2)

Tag

OOP, Algorithm, list, Gecko, CS, DB, 크레스티드게코, class, 게코, 파이썬, 항해, reptile, 알고리즘, Til, 파충류, django, 백준, Python, leetcode, SQL,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

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

티스토리툴바