목록코딩테스트 (19)
코딩
programmers.co.kr/learn/courses/30/lessons/42883 코딩테스트 연습 - 큰 수 만들기 programmers.co.kr def solution(number, k): n = len(number) answer = [number[0]] for num in number[1: ]: while answer and answer[-1] 0: # answer 마지막 숫자가 num보다 작으면 안됨 answer.pop() k -= 1 # if k == 0 이면 주어진 k를 다 쓴 것 answer.append(num) if k != 0: # 만약 k를 다 쓰지 않았다면 answer = number[: -k] return ''.join(answer) solution("..
www.hackerrank.com/challenges/crush/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=arrays Array Manipulation | HackerRank Perform m operations on an array and print the maximum of the values. www.hackerrank.com 코드 1 def arrayManipulation(n, queries): indices = [0] * (n+1) max_val = 0 for start, end, value in queries: for i in range(start, end+1): indice..
www.hackerrank.com/challenges/climbing-the-leaderboard/problem Climbing the Leaderboard | HackerRank Help Alice track her progress toward the top of the leaderboard! www.hackerrank.com from bisect import bisect_right def climbingLeaderboard(ranked, player): answer = [] ranked = sorted(set(ranked)) # 중복제거 for score in player: answer.append(len(ranked)-bisect_right((ranked), score)+1) return answe..