1244. Design A Leaderboard

3가지 기능이 있는 Leaderboard 클래스를 설계

  • addScore(playerId, score): 주어진 플레이어의 점수에 점수를 추가하여 순위표를 업데이트
  • top(K): 상위 K 플레이어의 점수 합계를 반환
  • reset(playerId): 주어진 ID를 가진 플레이어의 점수를 0으로 재설정(즉, 리더보드에서 삭제)

Continue reading

993. Cousins in Binary Tree

고유한 값을 가진 이진 트리의 루트와 트리 x 및 y의 서로 다른 두 노드 값이 주어지면, 트리의 값 x 및 y에 해당하는 노드가 사촌이면 true를 반환하고 그렇지 않으면 false를 반환
이진 트리의 두 노드는 다른 부모와 동일한 깊이를 갖는 경우 사촌

Continue reading

146. LRU Cache

LRU(최소 사용) 캐시의 제약 조건을 따르는 데이터 구조를 설계

  • int get(int key) Return the value of the key if the key exists, otherwise return -1.
  • void put(int key, int value) Update the value of the key if the key exists. Otherwise, add the key-value pair to the cache. If the number of keys exceeds the capacity from this operation, evict the least recently used key.
  • The functions get and put must each run in O(1) average time complexity.

Continue reading

242. Valid Anagram

두 문자열 s와 t가 주어지면 t가 s의 애너그램이면 true를 반환하고 그렇지 않으면 false를 반환 An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.

Continue reading

Pagination


© 2017. by yeopoong.github.io

Powered by yeopoong