Well, if we go by the Stack Exchange definition of spam, neither of them qualify (and spam flags on those posts would likely be declined):
Spam is an unsolicited commercial advertisement. We've all seen it, and we all know what it looks like. It looks like the same stuff you see in your spam folder when you look at your email.
Because each post flagged as spam comes with a -100 reputation penalty, and the risk of users being fed into the spam blocking systems, these should generally not be flagged as spam.
However, there is a different issue at hand: self promotion. The help center has a good section on this I'll quote:
Avoid overt self-promotion.
The community tends to vote down overt self-promotion and flag it as spam. Post good, relevant answers, and if some (but not all) happen to be about your product or website, that’s okay. However, you must disclose your affiliation in your answers.
If a large percentage of your posts include a mention of your product or website, you're probably here for the wrong reasons. Our advertising rates are quite reasonable; contact our ad sales team for details. We also offer free community promotion ads for open source projects and non-profit organizations.
That captures it really well in my opinion—if you're clearly just here to try and sell your product, then you're not here for the right reasons, but if you genuinely think your product could solve a problem, it's fine to share it in a small percentage of your posts.
I would say the most balanced approach would be to vote on the posts based on how useful you find them—if you think it's unhelpful, vote down, although using a custom flag to explain that you think the promotion is inappropriate would also be acceptable generally.
Admittedly, a self-answer does raise some suspicion, but I'd personally give people the benefit of the doubt at this stage—it's easy to get caught on the wrong side of self-promotion rules, and if the intention was good, I wouldn't object.
What I think would make a better answer is something along these lines:
Q: How do I solve foo?
A: I wanted to solve this, so I investigated these approaches:
Baz works particularly well because _______. I developed this idea into a product ([insert relevant link here]) which may be helpful.
This way, you're teaching everyone else how to solve problems while still giving them a pre-made solution and a link to your project. Sharing your relevant experiences and solutions while developing the product would be fascinating. A description of what your product does... a little less so.