Generally I find with programming and problem solving problems I work well with a mix of time alone to implement and try ideas followed by some time discussing the problem with others. Often just talking through a problem leads to a solution you hadn't considered, or someone else's input forces you to think about other aspects of the problem. However, trying to actually implement the solution with someone looking over your shoulder definitely doesn't help.