For testing purposes
- Sorting algorithm, required by the first part of the task located in this file: TestProject/TestProject.Sorting/CardHelpers.cs. It is split in two parts. First part only looks for the first card in a stack. Second part do the rest of the job. I'm not an algorithm guru, so my algorithms based only on logical conclusions.
As for the complexity, I guess it's something about O(n^2).
- And here is SQL query, required for the second part of the test task
select productid, count(productid) [count]
from (
select customerid, min([datetime]) as [datetime] from SalesTable
group by customerid
) as x
inner join SalesTable s on s.customerid = x.customerid and s.[datetime] = x.[datetime]
group by productidAnyways, that was definitely fun. :)