dongur2 / codingtest_java Goto Github PK
View Code? Open in Web Editor NEW코딩테스트 연습
코딩테스트 연습
: 2개의 자연수의 최대공약수를 구하는 알고리즘
int GCD(int a, int b) { if (b == 0) return a; else GCD(b, a % b); }
새로운 데이터는 맨 끝/맨 뒤(rear)에 추가되고, 데이터를 꺼낼 때는 다른 끝/맨 앞(head)에서 꺼내어 사용
enqueue
큐의 rear에 새로운 데이터 삽입 [INSERT]dequeue
큐의 front에서 데이터를 반환하고 삭제 [DELETE]peek
큐의 front에 있는 데이터 반환isEmpty
큐가 비어 있는지 확인isFull
큐가 가득 찼는지 확인
https://www.tcpschool.com/java/java_collectionFramework_stackQueue
E peek()
해당 스택의 제일 상단에 있는 요소 반환 - 제일 마지막으로 저장된 요소
E pop()
해당 스택의 제일 상단에 있는 요소를 반환하고, 해당 요소를 스택에서 제거
E push(E item)
해당 스택의 제일 상단에 전달된 요소를 삽입
스택 생성
Stack<Integer> st = new Stack<>();
void arraycopy(Object 원본 배열, int 복사 시작 인덱스, Object 복사받을 배열, int 시작 인덱스, int 복사 길이)
배열을 특정 위치부터 복사하여 다른 배열의 매개변수에서 지정한 특정 위치부터 붙여넣는다. 복사 길이보다 복사해온 배열이 짧을 경우 0으로 채워넣는다.
T[] copyOf(T[] 원본 배열, int 복사 길이)
배열을 자르거나 0으로 채워넣어서 배열을 복사한다.
같은 타입 객체들 을 비교하여 '오름차순으로 정렬(natural order)'하는 전략을 정의하는 인터페이스
@Override
public int compareTo(T param) {
return Integer.compare(x, y);
}
Integer.compare(x, y)
메서드의 리턴값으로 정렬
compare(arg1, arg2)
메서드를 정의하여 다른 타입 객체들 을 비교해 정렬할 수 있는 더 유연한 인터페이스
@Override
public int compare(arg1, arg2) {
return Integer.compare(x, y);
}
중복을 허용하지 않는 대신 순서를 보장하지 않는 Set에서 데이터 저장 순서를 고정해준다.
LinkedHashSet<Integer> linkedHashSet = new LinkedHashSet<>();
https://www.baeldung.com/java-linkedhashset
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.