A certain candidate applied for a certain company. The company asked the candidate to write some code for the interview process, and it turned out to be quite well written and could qualify as a complete product.
Would the company in question be able to use this code without legal hassles, or does the code belong to the candidate?
The code uses the company's API to fetch data and show it to the user as a browser extension. The data belongs to the company and partners. Can the company use the code without the candidate's permission?
You wrote the code before being hired (or maybe you even wern't hired) - so the application is your property. They ask for it but you are the owner unless they pay for it. Or unless they hire you telling in the contract that you transfer the property to the company. But in the actual situation, you are the only owner.
They ask for it: no problem, it doesn't change anything
You used some data from their web: if the application is data independent and can be used for any other company/website etc. there is not problem neither - the code doesn't need THEIR data so it is still your property (you coud have use some other company website as "developping case"...) Here I assume that it is a data independent code and could have been developped with "doesn't matter whom data". Edit: Disclaimer: I am not a lawyer. My answers are based on my experience and on the "common sense". It is just informative - for important questions, contact a lawyer in your country/region/district.
The code written by the candidate, prior to employment, is the candidates.
If the code written requires the use of the companies API, data, branding or other intellectual property in order function; the candidate would be unable to re-use/sell the code as-is as it contains the intellectual property of the company.
The candidates code was provided to the company in order to apply for a job so therefor by providing the code you have in effect licensed the company to use your code as long as it is furthering your application. If you were successful in getting the job, and part of the contract was the transfer of intellectual property ownership on all code you write for the company, the code would then be the companies intellectual property. If it was used for another purpose they would be breaching your intellectual property.
The company would not be in breach for using their own API and code as it is their intellectual property.
Let me avoid the legal question (although I am a lawyer – but NOT providing any legal advice here), and examine the question from the perspective of the software industry.
This is an issue that should never come up, especially in an industry renowned for a very tight networking circles (such as on sites like this one). In Seattle, for example, it is not at all uncommon to have worked for Microsoft, and Amazon, and other top brands, and everyone talks to one another. There are no deep dark secrets in the world of interviewing for top software firms, nor the many start-ups formed by teams from those companies. No company wants to be known as one that steals ideas from interviewees, and most credible companies would not have allowed the interviewee to show the code in an interview without FIRST documenting in writing who would own it.
If you are the interviewee, and you presented the code: You have every right to expect the code will not be used. You had no obligation to produce intellectual property or products in exchange for being interviewed, and I would argue that being interviewed is NOT an exchange (compensation) for them to obtain any rights you may have to the code. The outcome in any given legal jurisdiction may vary, but there is certainly an appearance of impropriety on the part of the company.
If you are the company, and you received the code: Immediately ensure the interviewee knows you will NOT be using the code in any way. Immediately apologize for acting like a petty and amateurish company which no one would want to work with, especially since you evidenced a lack of ethics during the interview process. IF you (the company) want to use the code then either hire the person to write it for you, or at least offer them an (IC) independent contractor deal to pay the developer. No amount of money saved by acting unethically will be worth the long term reputation damage to the company, the product, and the executive staff. This kind of behavior screams “we are not trustworthy, and we will likely not be in business long.”
My best legal advice is never act unethically and then expect the law to protect you from earning a reputation as a non-ethical person. These are not hard decisions to come to on your own when you follow some basic rules; Be kind, act fairly, and ALWAYS apologize if you have done anything wrong (even unintentionally). Nothing avoids lawsuits more than those three things.