We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Array Of N Elements
Array Of N Elements
Sort by
recency
|
202 Discussions
|
Please Login in order to post a comment
You can solve this challenge by simply generating an array of size n and filling it with integers, for example from 0 to n-1. This ensures the array length matches the input and all elements are valid integers. The logic works the same across languages like Python, Java, or C++. For more resources, check https://cooksmenuout.com/cookout-careers/ .
You just need to return an array of n integers. The values can be anything, as long as the array length matches the input. For example, if n = 5, valid outputs could be [0,1,2,3,4] or [10,20,30,40,50]. This simple task helps beginners practice arrays and is often found in an Educational Guide for American Universities.
Elixir is broken for this with my solutions. I have tried in several different ways and I still get 2 failing tests when submitting. The rest of the tests are ok and the failed ones are expecting the given number N as the result and not the list with N elements for some reason.
Scala has been broken To compelte this in scala you have to add some imports, remove the print statement and change the return type to apply a valid string rather than a list for this to complete.
scala