Is referencing online solution acceptable when completing assignments
This depends on the rules of the course and has no general answer. For some courses and for some assignments within them, this would be expected. In others, forbidden. Only the instructor can give you guidance. 

But, you did the right thing in citing it. You were honest. Also, you learned something, which was the point of the assignment. But perhaps you didn't learn the right thing, which may have been the point: working through to a solution on your own. 

The rules of a course should be clear. It is a problem when they aren't. But if challenged on this, just stress your honesty in citing your source. And follow the rules as you then understand them. But, sadly, instructors sometimes have unspoken expectations. 

If I were your professor, and had neglected to make the ground rules clear, I'd accept your work, given the citation, but also caution you about future work if I'd rather you came to me instead of external sources. A professor can sometimes give a minimal hint to get a student over a block, but still allow for deeper learning to occur than can be done when searching out solutions. But I would also have to publish the ground rules.