Solución

AL@albertoube_c3e487bc·3/7/2026TypeScript
solution.tsTypeScript
public class Solution {
    public boolean endsWithSuffix(String str, String suffix) {

        if(suffix.isEmpty()) return true;
        if(str.isEmpty()) {
            return true;
        } else if (suffix.length() > str.length()) {
            return false;
        }
        for(int i = 0; i < suffix.length(); i++) {
            char sufijo = suffix.charAt(i);

            char comparacion = str.charAt(str.length() - suffix.length() + i);

            if(sufijo == comparacion) {
                return true;
            }
        }
        return false;
    }
}
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.