llighter / yunha-ind

YUNHA INDUSTRY website
https://llighter.github.io
MIT License
1 stars 0 forks source link

content: 배열중 일부를 새로운 배열로 가져오는 올 때 고려할 점 #73

Closed llighter closed 3 years ago

llighter commented 3 years ago

Author: @llighter

Target publish date: 2020-07-25

Process

Check out the web.dev writing process.

When you're ready, make a copy of this template and fill in the proposal and outline sections. When you're finished, drop a link to the doc in the 1st step below and check the box. A member of the web.dev team will assign this ticket to themselves and work as your reviewer to help you complete the remaining steps.

llighter commented 3 years ago

이번 주제는 배열이다. 기존 배열을 가지고 조작을 할 때 어떻게 해야 효율적으로 가져오는지 공부한다. 이 문제를 생각하게된 이유는 프로그래머스 문제 중 K번째수 를 풀다가 배열을 조작해야하는 상황에 부딪쳤는데

  1. 자바에서 배열의 일부를 새로운 배열로 가져오는 함수가 있는지
  2. 내가 직접 배열의 일부를 새로운 배열로 가져로는 경우 for loop를 사용할 텐데 이것이 효율적인 것인지

위의 내용을 확인하고 싶기 때문이다.

내가 자주사용하는 언어는 자바자바스크립트 이므로 이 두 언어가 배열의 일부를 가져올 때 어떤식으로 처리하는게 효율적인지 공부해보자.

llighter commented 3 years ago

Javascript

Array.prototype.slice() ECMAScript

JAVA

copyOfRange Get only part of an Array in Java? System.arrayCopy

DART

sublist method