Solución
solution.tsTypeScript
public class Solution {
public static String intercalateChars(String first, String second) {
if (first.isEmpty() && second.equals(first)) return "";
int firstLen = first.length();
int secondLen = second.length();
int maxLen = Math.max(firstLen, secondLen);
StringBuilder sb = new StringBuilder();
String resultado= "";
for (int i = 0; i < maxLen; i++) {
// Agregamos el carácter de la primera cadena si aún hay disponibles
if (i < firstLen) sb.append(first.charAt(i));
if (i < secondLen) sb.append(second.charAt(i));
}
resultado = sb.toString();
return resultado;
}
}0respuestas