136. Single Number
in Coding Interview on Array, Bit-manipulation
정수 배열이 주어지면 모든 원소 중에서 한번만 존재하는 원소 찾기
in Coding Interview on Array, Bit-manipulation
정수 배열이 주어지면 모든 원소 중에서 한번만 존재하는 원소 찾기
in Coding Interview on Array, Bit-manipulation
정확히 두 개의 요소가 한 번만 나타나고 다른 모든 요소는 정확히 두 번 나타나는 정수 배열 nums에서 한 번만 나타나는 두 요소 찾기
in Coding Interview on Medium, Design, HashMap, Linked List
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.
문자열 s1, s2 및 s3이 주어지면 s3이 s1 및 s2의 인터리빙에 의해 형성되는지 확인
An interleaving of two strings s and t is a configuration where s and t are divided into n and m substrings respectively
in Coding Interview on Easy, Math
Happy Number: 자릿수 제곱의 합이 1 이 되는 수
in Coding Interview on Tree, DFS
이진 트리의 루트가 주어지면 트리 지름(두 노드간의 가장 긴 경로)의 길이를 반환합니다.
in Coding Interview on Medium, Tree, DFS
이진 트리의 루트가 주어지면 오른쪽에 서 있는 자신을 상상하고 위에서 아래로 정렬된 노드의 값을 반환
in Coding Interview on Topics, Bit-manipulation
비트 조작
- XOR 연산을 사용하면 여러개의 값 중에서 동일한 값들을 제거할 수 있다(동일한 값의 순서는 상관없다)
- XOR 연산으로 암호화 할 수 있다.