[CS] 2. Data Structure
·
Tech Interview/CS
1. 배열 Array배열 회전 알고리즘기본 회전 알고리즘 temp 활용 void leftRotatebyOne(int arr[], int n){ int temp = arr[0]; for(int i=0;i 저글링 알고리즘 최대공약수 gcd 활용 더보기gcd 최대공약수 -> 유클리드 호제법 - 큰 수를 작은 수로 나눈 나머지로 바꿔도 최대공약수는 변하지 않는다. int gcd(int a, int b){ if(b==0) return a; else return gcd(b, a%b); }int gcd(int a, int b){ //최대공약수 = 사이클의 개수 if(b==0) return a; else return gcd(b, a%b);}void leftRotate(int arr[], in..