find() vs children()
children() - 해당 노드의 자식들만 탐색
find() - 해당 노드의 자손들까지 탐색 ( 전체 DOM )
DOM 구조의 차이에 따라 성능 차이가 발생 할 수 있으나 유의미한 정도의 차이는 아닌 것 같다.
상황에 맞게 선택해서 사용 하는 것이 좋을것 같다.
find() vs children()
children() - 해당 노드의 자식들만 탐색
find() - 해당 노드의 자손들까지 탐색 ( 전체 DOM )
DOM 구조의 차이에 따라 성능 차이가 발생 할 수 있으나 유의미한 정도의 차이는 아닌 것 같다.
상황에 맞게 선택해서 사용 하는 것이 좋을것 같다.
Remove Duplicates
You are to write a function called unique that takes an array of integers and returns the array with duplicates removed. It must return the values in the same order as first seen in the given array. Thus no sorting should be done, if 52 appears before 10 in the given array then it should also be that 52 appears before 10 in the returned array.
Assumptions
All values given are integers (they can be positive or negative).
You are given an array but it may be empty.
They array may have duplicates or it may not.
You cannot use the uniq method on Arrays (don't even try it), or the nub function from Data.List.
Example
UniqueArray.unique([1, 5, 2, 0, 2, -3, 1, 10])
// -> [1, 5, 2, 0, -3, 10]
codewars #88 Which are in? (6kyu) (0) | 2018.07.30 |
---|---|
codewars #87 Extract the IDs from the data set (6kyu) (0) | 2018.07.27 |
codewars #85 Circularly Sorted Array (6kyu) (0) | 2018.07.25 |
codewars #84Can you get the loop ? (5kyu) (0) | 2018.07.24 |
codewars #83 Stop gninnipS My sdroW! (6kyu) (0) | 2018.07.23 |
Write a method, isCircleSorted(int[] A) (Java, JavaScript), or Array#circularly_sorted? (Ruby) that determines if A is circularly sorted. An Array is circularly sorted if the elements are sorted in ascending order, but displaced, or rotated, by any number of steps.
For Example:
// True:
isCircleSorted([2,3,4,5,0,1]);
isCircleSorted([4,5,6,9,1]);
isCircleSorted([10,11,6,7,9]);
isCircleSorted([1,2,3,4,5]);
isCircleSorted([5,7,43,987,-9,0]);
// False:
isCircleSorted([4,1,2,5]);
isCircleSorted([8,7,6,5,4,3]);
isCircleSorted([6,7,4,8]);
isCircleSorted([7,6,5,4,3,2,1]);
codewars #87 Extract the IDs from the data set (6kyu) (0) | 2018.07.27 |
---|---|
codewars #86 Remove Duplicates(7kyu) (0) | 2018.07.26 |
codewars #84Can you get the loop ? (5kyu) (0) | 2018.07.24 |
codewars #83 Stop gninnipS My sdroW! (6kyu) (0) | 2018.07.23 |
codewars #82Evil Autocorrect Prank (6kyu) (0) | 2018.07.19 |