Solución

VD@vekzz-dev·hace 4dTypeScript
solution.tsTypeScript
public class Solution {
  public 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

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.