Solución

@adriantalonia11_d49a8106·29/7/2026TypeScript
solution.tsTypeScript
public class Solution {
    public boolean startsWith(String text, String prefix) {
        // Escribe tu solución aquí
        if (prefix == null || prefix.isEmpty()) {
            return true;
        }

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

        //String start = text.trim().split(" ")[0];
        //String start = text.substring(0, prefix.length());
        String start = text.trim().substring(0, prefix.length());

        return start.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.