Solución

@yersongalvis03_e9a14c4c·14/5/2026TypeScript
solution.tsTypeScript
public class Solution {
    public boolean startsWith(String text, String prefix) {

        if(prefix == ""){
            return true;
        }

        if(text.length() < prefix.length()){
            return false;
        }

        int prefixCount = prefix.length();
        String texto = text.substring(0,prefixCount);
        return texto.equals(prefix);
    }
}
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.