If you know something about loops or the fundamental group, then you can do it pretty easily. If not, the method needs a bit of explaining:

The idea is to consider closed paths / curves in each space. (A path is a continuous function

. If it is closed, then its beginning point is the same as its end point; that is,

.) Then you can try to play around with the loops by deforming them continuously. It then turns out that you can put different kinds of loops into different equivalence classes - we say that two loops are equivalent if one can be deformed into the other (and vice versa). (For example, a loop that wraps around a circle once cannot be deformed into a loop that wraps around the circle twice.) Then, if two spaces are homeomorphic, those equivalence classes of loops should be the same, in some sense. It is possible to show that

has infinitely many classes of loops and a line segment has only one. Therefore, the two cannot be homeomorphic.