It's up to you where exactly you draw the line for yourself and write a separate second answer instead of adding to your first one, but I can give you some questions that may help you to decide:
How different is your second idea from the first one?
You may find another approach to a problem, maybe using different tools or just going another way. Evaluate how big the difference is. Are both ways similar enough to be included in the same post, or are they radically different, having nothing in common?
For example, you have solutions to solve a task with sed
, awk
, bash
or python
. Normally I would not consider this a too big difference, but maybe your algorithms are using totally different approaches, which makes you think they can be separated.
How long is/are your answer(s)?
If you already wrote a huge answer about how to solve the problem one way, and then you find another way to do it which requires a post of similar size, it might make sense to post that separately instead of overrunning the reader with an enormous wall of text, no matter how nicely formatted it might be. This might also apply if you have to include large scripts or other code snippets in each post. A rule of thumb might be that more than one or two pages on the screen (depending on your screen size; your mileage may vary) are undesirable.
How different is the outcome?
Possibly the question is rather open and leaves space for interpretation, or the exact thing which is asked for is not possible and you can give a choice between two alternatives instead. If your solutions generate quite different results, it might be useful to post them separately.
Should they be scored independently?
Well, of course two answers means everybody can upvote you twice, so that is good, right? Yes, but that is not my point. Do you think people would make a difference between your posts when deciding how to vote? If there is a reason for you to believe the scores of your posts will differ significantly, maybe because one of the solutions is much better, worse or maybe more controversial, then it might make sense to post two answers.
Is there a notable age difference / does the first post already have a notable vote score?
In case your first post is a bit older and maybe has already reached a decent score (depending on the context, maybe more than 5 or 10 points?), it might make sense to post your second idea that you had later in a different post, if it is not really just an update to the first one. That way you make sure that the votes for post one stay for post one and don't get mixed up with people's opinion about post two.
So far my list of considerations about when to post a second answer or include multiple solutions in one. It is all quite vague and there are no hard rules, so use common sense and decide what fits best.
When in doubt, I'd recommend to stay with one longer single answer.