Solución

@unrealspirit_213c43f8
·hace 18hTypeScript
solution.tsTypeScript
public class Solution {
    public static boolean startsWith(String text, String prefix) {
        if (prefix.isEmpty()) return true;
        if (text.length() < prefix.length()) return false;

        for (int i = 0; i < prefix.length(); i++) {
            if(text.charAt(i) != prefix.charAt(i)){
                return false;
            }
        }return true;
    }
}
0respuestas
Respuestas
0

Aún no hay respuestas

¡Sé el primero en responder!

Escribir un comentario

Recuerda ser amable. Estás comentando la solución de otra persona. Comparte tu perspectiva de forma constructiva y respetuosa.

Debes iniciar sesión para publicar un comentario.
Markdown