Here is a description of the problem
Given an integer N, write a function that returns an integer array of size N containing numbers from 1 to N in random order. Each number from 1 to N should appear once and should not be repeated.
- What is the running time of your algorithm?
- Can your algorithm be improved?
For example: if you are given the number 4, your output should generate something like 4213, 2413, 3124, etc.
The invalid conclusions will be 1123, 4444, 244.
Any ideas to solve the problem?
source
share