Recursion for life 🫣✨ #computerscience #coding #stem #apcs #python #recursion

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Wow you’re really good at coding keep up the amazing work

Mr_popcat
Автор

Bros actually confusing the beginers, for a simple problem

TruthHunterHQ
Автор

i don’t do much programming, and i might be stupid but doesn’t
abbbba abcbba
return true with the code he used, when it should return false

TrevA
Автор

return a == b.reverse()

This problem doesnt have to be solved by recursion.

chaser
Автор

#include <stdio.h>
#include <string.h>
#include <stdbool.h>

bool is_reversed(char *s1, char *s2)
{
if (!s1 || !s2) return false;

size_t s1len = strlen(s1);
size_t s2len = strlen(s2);

if (s1len != s2len) return false;

size_t s1_i = 0;
size_t s2_i = s2len - 1;

for (; s1_i < s1len; s1_i++) {
if (s1[s1_i] != s2[s2_i]) {
return false;
}
s2_i--;
}

return true;
}

void print_boolean(bool v)
{
if (v) {
printf("True");
return;
}

printf("False");
}

int main()
{
print_boolean(
is_reversed(
"Kira Learning",
"gninraeL ariK"));

return 0;
}

СергейДехтярёв-ън
join shbcf.ru