[algorithm] Find the only Non-Duplicate Element in Array
주어진 배열(N: 2n+1)에서 단 1개만 중복(쌍을 가지지 않는)되지 않는 요소라고 할때본 요소를 찾는 방법으로 일반적으로 정렬 (오름차순이던 내림차순이던) 후 linear 하게 순차적으로 요소를 비교 하여 값 추출 하는 방법을 생각 할 수 있습니다. func searchNonDuplicateElement(A : [Int]) -> Int { var sorted = A.sorted() var idx = 0 while (true) { if sorted.count - 1 != idx { if sorted[idx] == sorted[idx + 1] { idx += 2 } else { return sorted[idx] } } else { return sorted[idx] } }} 먼저 배열을 정렬 한 다음 순차..
programming/etc
2018. 11. 6. 13:34
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 윈도우 라이브러리
- PCX
- rxswift
- reactivex
- angular
- yss
- ATS
- build set
- MEAN stack
- executable jar
- full stack
- ucrtbase.dll
- TLS1.2
- 대칭키
- App Transport Security
- HTTPS
- iOS10
- JavaScript
- Visual Studio
- Universal CRT
- TypedArray
- 비대칭키
- AES
- 전자서명
- execute double click
- node js
- 암호화
- remote debug
- Node.js
- cipher
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함