'Reducing the size of the array
This question would seem a little bit strange. The context is I have an array of variable size. Sometimes the array is of size 3 sometimes 7 sometimes 100, I cannot predict it. I need to perform computation on every element of the array, but this is not a feasible solution what I want to do is that I want to reduce the size of array. So suppose the array size is 3 then I would perform computation only on one element, If the array size is 100 then I would perform computation on every 10th element and so on. So I basically want to reduce the elements in this sense. If the array is like a=[1 2 3 4 6 7 8 9 ] I want to pick element 1 then 4 then 8 and so on. How can I find that logic
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
