Hi,
der Grund warum du eine leere Menge erhälst ist, dass find einen Wert in deinem Vector y2 sucht, der genau -0.5 ist. Ist sehr unwahrscheinlich, dass du den Wert "zufällig triffst". Da deine Bedingung lautet "<" solltest du also auch y<-0.5 verwenden. find wird auch den ersten index zurückgeben für die Bedingung zutrifft.
ich hätte das persönlich mit einer for oder while Schleife gelöst und bei erfüllung der Bedingung ein break gesetzt.
Best Answer