알고리즘이란?유한한 단계로 문제를 해결하는 로직이다. 컴퓨터가 어떤 일을 하는 수행의 단계적 방법이다. 효율적인 알고리즘메모리 공간을 최적화 하는 공간적 효율성, 수행 시간에 대해 최소의 시간을 고려하는 시간적 효율성 고려해야한다. 효율성이 즉 복잡도가 된다.이러한 부분은 아키텍처, 자료구조, HW 환경, SW 환경 등 다양한 요소를 고려해야한다. 복잡도의 점근적 표기 Big-Oh시간 복잡도를 입력 크기에 대한 함수로 표기할 수 있다. 이를 점근적 표기(Asymptotic Notation)라 한다.가장 큰 예로 Big-Oh 표기법이 있다. Big-Oh는 최대 이런 시간이 걸린다는 의미를 가진다.O(1) : 상수 시간 (Constant time)O(logn) : 로그(대수) 시간 (Logarithmic t..
출처 : https://www.hackerrank.com/challenges/extra-long-factorials/problem #include using namespace std; void extraLongFactorials(int n) { vector v; v.push_back(1); for (int i = 2; i n; cin.ignore(numeric_limits::max(), '\n'); extraLongFactorials(n); return 0;}
출처 : https://www.hackerrank.com/challenges/climbing-the-leaderboard/problem #include using namespace std; vector split_string(string); vector climbingLeaderboard(vector scores, vector alice) { int s_size = scores.size(); int a_size = alice.size(); vector ans(a_size), tmp(s_size); int n = 1; tmp[0] = n; for (int i = 1; i < s_size; i++) { if (scores[i] == scores[i - 1]) tmp[i] = n; else tmp[i] = +..
출처 : https://www.hackerrank.com/challenges/time-conversion/problem #include using namespace std; string timeConversion(string s) { if(s.substr(8,2)=="PM") { string ss = s.substr(0,2); int tmp = atoi(ss.c_str()); if(tmp==12) tmp=0; s.replace(0,2,to_string(tmp+12)); s.erase(8,2); } else { if(s.substr(0,2)=="12") s.replace(0,2,"00"); s.erase(8,2); } return s;} int main(){ ofstream fout(getenv("OUTP..
출처 : https://www.hackerrank.com/challenges/birthday-cake-candles/problem #include using namespace std; vector split_string(string); int birthdayCakeCandles(vector ar) { int ans=1; sort(ar.begin(),ar.end()); int tmp = ar[ar.size()-1]; if(ar.size()>2) { for(int i=ar.size()-2;i>=0;i--) { if(tmp==ar[i]) ans++; else break; } } else if(ar.size()==2) { if(tmp==ar[0]) ans++; } return ans;} int main(){ o..
출처 : https://www.hackerrank.com/challenges/diagonal-difference/problem #include using namespace std; int diagonalDifference(vector arr) { int ans1=0; int ans2=0; int s = arr.size(); for(int i=0,j=0; i>=0 && i> n; cin.ignore(numeric_limits::max(), '\n'); vector arr(n); for (int i = 0; i > arr[i][j]; } cin.ignore(numeric_limits::max(..
출처 : https://www.hackerrank.com/challenges/a-very-big-sum/problem #include using namespace std; vector split_string(string); long aVeryBigSum(vector ar) { long ans=0; for(int i=0; i> ar_count; cin.ignore(numeric_limits::max(), '\n'); string ar_temp_temp; getline(cin, ar_temp_temp); vector ar_temp = split_string(ar_temp_temp); vector ar(ar_count); for (int i = 0; i < ar_count; i++) { long ar_item..
- Total
- Today
- Yesterday
- boj
- STL
- 17837
- 게리맨더링 2
- 17142
- string
- 백준
- 2018 카카오 블라인드 채용
- 팁
- SW Expert Academy
- DFS
- 연구소 3
- 입출력
- 17779
- 이차원 배열과 연산
- 트렌드
- 17144
- DP
- 17143
- 2018 KAKAO BLIND RECRUITMENT
- 미세먼지 안녕!
- 역량 테스트
- scanf
- 17140
- SWEA
- 삼성
- 새로운 게임 2
- 시간 복잡도
- 알고리즘
- hackerrank
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |