![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Array
tianye00011
这个作者很懒,什么都没留下…
展开
-
Subarray Sort
PromptWrite a function that takes in an array of at least two integers and that returns an array of the starting and ending indices of the smallest subarray in the input array that needs to be sorted in place in order for the entire input array to be sort原创 2020-06-21 21:24:04 · 218 阅读 · 0 评论 -
Longest Peak
PromptWrite a function that takes in an array of integers and returns the length of the longest peak in the array.A peak is defined as adjacent integers in the array that are strictly increasing until they reach a tip (the highest value in the peak), at原创 2020-06-21 21:12:58 · 139 阅读 · 0 评论 -
Largest Range
PromptWrite a function that takes in an array of integers and returns an array of length 2 representing the largest range of integers contained in that array.The first number in the output array should be the first number in the range, while the second n原创 2020-06-21 20:59:09 · 215 阅读 · 0 评论 -
Spiral Traverse
PromptWrite a function that takes in an n x m twodimensional array (that can be square-shaped when n === m) and returns a one-dimensionalarray of all the array’s elements in spiralorder.Spiral order starts at the top left corner of thetwo-dimensional arr原创 2020-06-20 17:26:05 · 120 阅读 · 0 评论 -
Move Element To End
PromptYou’re given an array of integers and an integer. Write a function that moves all instances of that integer in the array to the end of the array and returns the array.The function should perform this in place (i.e., it should mutate the input array原创 2020-06-18 19:50:29 · 111 阅读 · 0 评论 -
Smallest Difference
PromptWrite a function that takes in two non-empty arrays of integers, nds the pair of numbers (one from each array) whose absolute dierence is closest to zero, and returns an array containing these two numbers, with the number from the rst array in the f原创 2020-06-18 19:43:59 · 183 阅读 · 0 评论 -
Monotonic Array
PromptWrite a function that takes in an array of integers and returns a boolean representing whether the array is monotonic.An array is said to be monotonic if its elements, from left to right, are entirely nonincreasing or entirely non-decreasing.Sampl原创 2020-06-18 19:28:46 · 77 阅读 · 0 评论