Do rejected candidates retain full rights to the code/workflow they've written for you?
If the task is more about working for a trial day or week, you'll be working in the company's codebase. You can expect to sign an NDA and to give up rights to your work. The company should pay you for this work.