Code Signal_练习题_extractEachKth
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                Code Signal_练习题_extractEachKth
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.                        
                                Given array of integers, remove each?kth?element from it.
Example
For?inputArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]?and?k = 3, the output should be
extractEachKth(inputArray, k) = [1, 2, 4, 5, 7, 8, 10].
?
我的解答:
def extractEachKth(inputArray, k):return [i for i in inputArray if i not in inputArray[k - 1::k]]?
def extractEachKth(inputArray, k):del inputArray[k-1::k]return inputArray 膜拜大佬?
轉(zhuǎn)載于:https://www.cnblogs.com/BlameKidd/p/9484481.html
總結(jié)
以上是生活随笔為你收集整理的Code Signal_练习题_extractEachKth的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: Golang Hello World
- 下一篇: 浅谈HTTP缓存
