I'm not sure if I'm overthinking this.
Recently I had an assignment that is intended to be completed individually in which I cannot understand one of the questions at all. Lectures didn't help as the question assumed we have known some mathematical concepts before this class.
So I searched online for solutions because I realized that I would have learned nothing by keep looking at the question myself. And not surprisingly I found a solution.
I read through it, understood the solution, and wrote in my own words on the assignment paper. However since it is a simple proof my solution is essentially the same, so I cited the webpage and explained that I have written this proof after reading through the solution.
I know this does not constitute plagiarism. What could I have done better in this situation?