Collecting Number Series
Imagine you've got this array of positive numbers, and you're on a mission to collect specific numbers from it. Each time, you can snatch the last number from the array and add it to your collection.
Your task is to figure out how many of these snatching operations you need to perform to collect numbers from 1 to k, inclusive.
So, what's the minimum number of snatching operations required to complete your collection? Find out and print the result.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)