Language/C++

[codility]Dominator

hyanghope 2019. 5. 12. 15:14
반응형

https://app.codility.com/programmers/lessons/8-leader/dominator/

 

Dominator coding task - Learn to Code - Codility

 

app.codility.com

코딜리티 Lesson 8 문제 StoneWallDominator을 풀어보았습니다 

주어진 배열에서 갯수가 절반이상인 수의 index중 아무거나를 return하는 문제였습니다

저는 절반이상인 수 즉 Leader를 구하는 알고리즘에서 index만 중간에 뽑는 idx변수를 써서 풀었습니다