Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
89453b7
[Sync Iteration] c/hello-world/1
exercism-solutions-syncer[bot] Apr 24, 2026
5a3d937
[Sync Iteration] c/isogram/1
exercism-solutions-syncer[bot] Apr 24, 2026
81343ee
[Sync Iteration] c/acronym/1
exercism-solutions-syncer[bot] Apr 24, 2026
41a218c
[Sync Iteration] c/word-count/1
exercism-solutions-syncer[bot] Apr 24, 2026
63dda51
[Sync Iteration] c/pangram/1
exercism-solutions-syncer[bot] Apr 24, 2026
f79ca18
[Sync Iteration] c/gigasecond/1
exercism-solutions-syncer[bot] Apr 24, 2026
f23c0c4
[Sync Iteration] c/space-age/1
exercism-solutions-syncer[bot] Apr 24, 2026
2a95d4d
[Sync Iteration] c/meetup/1
exercism-solutions-syncer[bot] Apr 24, 2026
dc50d2d
[Sync Iteration] c/hamming/1
exercism-solutions-syncer[bot] Apr 24, 2026
3ca2100
[Sync Iteration] c/rna-transcription/1
exercism-solutions-syncer[bot] Apr 24, 2026
3c5f0c5
[Sync Iteration] c/nucleotide-count/1
exercism-solutions-syncer[bot] Apr 24, 2026
2ba5d51
[Sync Iteration] c/grains/1
exercism-solutions-syncer[bot] Apr 24, 2026
2857144
[Sync Iteration] c/leap/1
exercism-solutions-syncer[bot] Apr 24, 2026
070b5ad
[Sync Iteration] c/beer-song/1
exercism-solutions-syncer[bot] Apr 24, 2026
cbc8dd3
[Sync Iteration] c/raindrops/1
exercism-solutions-syncer[bot] Apr 24, 2026
aaf0b26
[Sync Iteration] c/bob/1
exercism-solutions-syncer[bot] Apr 24, 2026
28247d3
[Sync Iteration] c/difference-of-squares/1
exercism-solutions-syncer[bot] Apr 24, 2026
de14f9c
[Sync Iteration] c/sum-of-multiples/1
exercism-solutions-syncer[bot] Apr 24, 2026
f24294b
[Sync Iteration] c/binary-search/1
exercism-solutions-syncer[bot] Apr 24, 2026
119d792
[Sync Iteration] c/anagram/1
exercism-solutions-syncer[bot] Apr 24, 2026
6494bd8
[Sync Iteration] c/roman-numerals/1
exercism-solutions-syncer[bot] Apr 24, 2026
0721a35
[Sync Iteration] c/allergies/1
exercism-solutions-syncer[bot] Apr 24, 2026
febb88e
[Sync Iteration] c/atbash-cipher/1
exercism-solutions-syncer[bot] Apr 24, 2026
907e3ef
[Sync Iteration] c/series/1
exercism-solutions-syncer[bot] Apr 24, 2026
f983674
[Sync Iteration] c/react/1
exercism-solutions-syncer[bot] Apr 24, 2026
22e138c
[Sync Iteration] c/phone-number/1
exercism-solutions-syncer[bot] Apr 24, 2026
add2bb5
[Sync Iteration] c/clock/1
exercism-solutions-syncer[bot] Apr 24, 2026
2e2a514
[Sync Iteration] c/sieve/1
exercism-solutions-syncer[bot] Apr 24, 2026
59cacb4
[Sync Iteration] c/nth-prime/1
exercism-solutions-syncer[bot] Apr 24, 2026
51daaa4
[Sync Iteration] c/robot-simulator/1
exercism-solutions-syncer[bot] Apr 24, 2026
72d6107
[Sync Iteration] c/pascals-triangle/1
exercism-solutions-syncer[bot] Apr 24, 2026
e0c4171
[Sync Iteration] c/triangle/1
exercism-solutions-syncer[bot] Apr 24, 2026
1a8f85e
[Sync Iteration] c/perfect-numbers/1
exercism-solutions-syncer[bot] Apr 24, 2026
ae4d276
[Sync Iteration] c/collatz-conjecture/1
exercism-solutions-syncer[bot] Apr 24, 2026
05acc29
[Sync Iteration] c/binary/1
exercism-solutions-syncer[bot] Apr 24, 2026
78d983a
[Sync Iteration] c/all-your-base/1
exercism-solutions-syncer[bot] Apr 24, 2026
e48fd6d
[Sync Iteration] c/palindrome-products/1
exercism-solutions-syncer[bot] Apr 24, 2026
017bcb7
[Sync Iteration] c/sublist/1
exercism-solutions-syncer[bot] Apr 24, 2026
efb6113
[Sync Iteration] c/largest-series-product/1
exercism-solutions-syncer[bot] Apr 24, 2026
9b8cad0
[Sync Iteration] c/scrabble-score/1
exercism-solutions-syncer[bot] Apr 24, 2026
b4a0ae7
[Sync Iteration] c/queen-attack/1
exercism-solutions-syncer[bot] Apr 24, 2026
ee7b4d1
[Sync Iteration] c/complex-numbers/1
exercism-solutions-syncer[bot] Apr 24, 2026
5a2fbd2
[Sync Iteration] c/etl/1
exercism-solutions-syncer[bot] Apr 24, 2026
44c2519
[Sync Iteration] c/prime-factors/1
exercism-solutions-syncer[bot] Apr 24, 2026
e7da19d
[Sync Iteration] c/luhn/1
exercism-solutions-syncer[bot] Apr 24, 2026
66d9291
[Sync Iteration] c/matching-brackets/1
exercism-solutions-syncer[bot] Apr 24, 2026
21c2f2d
[Sync Iteration] c/say/1
exercism-solutions-syncer[bot] Apr 24, 2026
640f00c
[Sync Iteration] c/crypto-square/1
exercism-solutions-syncer[bot] Apr 24, 2026
c5f69e1
[Sync Iteration] c/secret-handshake/1
exercism-solutions-syncer[bot] Apr 24, 2026
cbb0646
[Sync Iteration] c/pig-latin/1
exercism-solutions-syncer[bot] Apr 24, 2026
3866f82
[Sync Iteration] c/minesweeper/1
exercism-solutions-syncer[bot] Apr 24, 2026
e68593e
[Sync Iteration] c/run-length-encoding/1
exercism-solutions-syncer[bot] Apr 24, 2026
0e7ae61
[Sync Iteration] c/two-fer/1
exercism-solutions-syncer[bot] Apr 24, 2026
5ce4290
[Sync Iteration] c/wordy/1
exercism-solutions-syncer[bot] Apr 24, 2026
0cf5f14
[Sync Iteration] c/binary-search-tree/1
exercism-solutions-syncer[bot] Apr 24, 2026
865c76d
[Sync Iteration] c/diamond/1
exercism-solutions-syncer[bot] Apr 24, 2026
2da4493
[Sync Iteration] c/linked-list/1
exercism-solutions-syncer[bot] Apr 24, 2026
b4e8193
[Sync Iteration] c/armstrong-numbers/1
exercism-solutions-syncer[bot] Apr 24, 2026
bc51b95
[Sync Iteration] c/darts/1
exercism-solutions-syncer[bot] Apr 24, 2026
b459fb2
[Sync Iteration] c/resistor-color/1
exercism-solutions-syncer[bot] Apr 24, 2026
661a970
[Sync Iteration] c/resistor-color/2
exercism-solutions-syncer[bot] Apr 24, 2026
2593ba8
[Sync Iteration] c/saddle-points/1
exercism-solutions-syncer[bot] Apr 24, 2026
672a1e0
[Sync Iteration] c/resistor-color-duo/1
exercism-solutions-syncer[bot] Apr 24, 2026
e2d0a34
[Sync Iteration] c/resistor-color-trio/1
exercism-solutions-syncer[bot] Apr 24, 2026
925ed3d
[Sync Iteration] c/square-root/1
exercism-solutions-syncer[bot] Apr 24, 2026
3468c05
[Sync Iteration] c/pythagorean-triplet/1
exercism-solutions-syncer[bot] Apr 24, 2026
c3429d3
[Sync Iteration] c/rational-numbers/1
exercism-solutions-syncer[bot] Apr 24, 2026
f4f2d60
[Sync Iteration] c/list-ops/1
exercism-solutions-syncer[bot] Apr 24, 2026
9dba69e
[Sync Iteration] c/circular-buffer/1
exercism-solutions-syncer[bot] Apr 24, 2026
9fb1a54
[Sync Iteration] c/grade-school/1
exercism-solutions-syncer[bot] Apr 24, 2026
a4524a1
[Sync Iteration] c/rail-fence-cipher/1
exercism-solutions-syncer[bot] Apr 24, 2026
4d1b424
[Sync Iteration] c/two-bucket/1
exercism-solutions-syncer[bot] Apr 24, 2026
2e90616
[Sync Iteration] c/reverse-string/1
exercism-solutions-syncer[bot] Apr 24, 2026
65a379a
[Sync Iteration] c/high-scores/1
exercism-solutions-syncer[bot] Apr 24, 2026
3092e2f
[Sync Iteration] c/kindergarten-garden/1
exercism-solutions-syncer[bot] Apr 24, 2026
8f0c2c8
[Sync Iteration] c/eliuds-eggs/1
exercism-solutions-syncer[bot] Apr 24, 2026
7ff7455
[Sync Iteration] c/protein-translation/1
exercism-solutions-syncer[bot] Apr 24, 2026
87cd442
[Sync Iteration] c/knapsack/1
exercism-solutions-syncer[bot] Apr 24, 2026
d8b90e6
[Sync Iteration] c/spiral-matrix/1
exercism-solutions-syncer[bot] Apr 24, 2026
fb936d9
[Sync Iteration] c/zebra-puzzle/1
exercism-solutions-syncer[bot] Apr 24, 2026
ca30c7e
[Sync Iteration] c/yacht/1
exercism-solutions-syncer[bot] Apr 24, 2026
e7fbfd8
[Sync Iteration] c/rotational-cipher/1
exercism-solutions-syncer[bot] Apr 24, 2026
44ed168
[Sync Iteration] c/dnd-character/1
exercism-solutions-syncer[bot] Apr 24, 2026
ddbfa11
[Sync Iteration] c/variable-length-quantity/1
exercism-solutions-syncer[bot] Apr 24, 2026
5015463
[Sync Iteration] c/intergalactic-transmission/1
exercism-solutions-syncer[bot] Apr 24, 2026
d5e9e1e
[Sync Iteration] c/flower-field/1
exercism-solutions-syncer[bot] Apr 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions solutions/c/acronym/1/acronym.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Dedicated to Shree DR.MDD — eternal guidance in code

#include "acronym.h"
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

char *abbreviate(const char *input)
{
const char *s = input;

if (s == NULL || *s == 0)
return NULL;

int flag = 1;

char *ans = malloc(strlen(input));

char *temp = ans;

while (*s) {
if (!isalnum(*s) && *s != '\'') {
flag = 1;
} else if (flag) {
*temp++ = toupper(*s);
flag = 0;
}
s++;
}

*temp = 0;

return ans;
}
4 changes: 4 additions & 0 deletions solutions/c/acronym/1/acronym.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef ACRONYM_H
#define ACRONYM_H
char *abbreviate(const char *phrase);
#endif
26 changes: 26 additions & 0 deletions solutions/c/all-your-base/1/all_your_base.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// for Shree DR.MDD
#include "all_your_base.h"

#include <math.h>

size_t rebase(int8_t arr[DIGITS_ARRAY_SIZE], int16_t src_base, int16_t dst_base, size_t src_length) {
if (src_length < 1 || src_base <= 1 || dst_base <= 1) goto FL;
uint32_t total = 0;
for (size_t idx = 0; idx < src_length; idx++) {
int val = arr[src_length - 1 - idx];
if (val < 0 || val >= src_base) goto FL;
total += val * pow(src_base, idx);
}
int highest = 0;
for (highest = 0; pow(dst_base, highest + 1) < total; highest++);
size_t size = highest + 1;
for (size_t idx = 0; idx < size; idx++) {
int division = pow(dst_base, highest - idx);
arr[idx] = total / division;
total -= arr[idx] * division;
}
return size;
FL:
arr[0] = 0;
return 0;
}
6 changes: 6 additions & 0 deletions solutions/c/all-your-base/1/all_your_base.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once
#include <stddef.h>
#include <stdint.h>
#define DIGITS_ARRAY_SIZE 64
size_t rebase(int8_t digits[DIGITS_ARRAY_SIZE], int16_t input_base,
int16_t output_base, size_t input_length);
18 changes: 18 additions & 0 deletions solutions/c/allergies/1/allergies.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Dedicated to Shree DR.MDD

#include "allergies.h"

bool is_allergic_to(allergen_t item, unsigned int mask){
return (1 << item) & mask;
}

allergen_list_t get_allergens(unsigned int mask){
allergen_list_t result = {0};

for (unsigned int idx = 0, bit = 1; idx < ALLERGEN_COUNT; idx++, bit <<= 1){
result.allergens[idx] = bit & mask;
if (result.allergens[idx]) result.count++;
}

return result;
}
21 changes: 21 additions & 0 deletions solutions/c/allergies/1/allergies.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef ALLERGIES_H
#define ALLERGIES_H
#include <stdbool.h>
typedef enum {
ALLERGEN_EGGS = 0,
ALLERGEN_PEANUTS,
ALLERGEN_SHELLFISH,
ALLERGEN_STRAWBERRIES,
ALLERGEN_TOMATOES,
ALLERGEN_CHOCOLATE,
ALLERGEN_POLLEN,
ALLERGEN_CATS,
ALLERGEN_COUNT,
} allergen_t;
typedef struct {
int count;
bool allergens[ALLERGEN_COUNT];
} allergen_list_t;
bool is_allergic_to(allergen_t allergen, unsigned int score);
allergen_list_t get_allergens(unsigned int score);
#endif
46 changes: 46 additions & 0 deletions solutions/c/anagram/1/anagram.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Dedicated to Shree DR.MDD — eternal guidance in code

#include "anagram.h"
#include "anagram.h"
#include <ctype.h>
#include <string.h>

#define BUFFER 200

anagram_status validate(const char * src, const char * dst);

anagram_status validate(const char * src, const char * dst){
size_t len = strlen(src);
int mark = 0;

if (len != strlen(dst)) return NOT_ANAGRAM;

for (size_t i = 0; i < len; i++) {
if (tolower(dst[i]) != tolower(src[i])) {
mark++;
break;
}
}

if (mark == 0) return NOT_ANAGRAM;

int freq[BUFFER];
for (int i = 1; i < BUFFER; i++) freq[i] = 0;

for (size_t i = 0; i < len; i++) {
freq[tolower(src[i])]++;
freq[tolower(dst[i])]--;
}

for (int i = 1; i < BUFFER; i++) {
if (freq[i]) return NOT_ANAGRAM;
}

return IS_ANAGRAM;
}

void find_anagrams(const char * src, struct candidates * arr){
for (size_t i = 0; i < arr->count; i++) {
arr->candidate[i].is_anagram = validate(src, arr->candidate[i].word);
}
}
19 changes: 19 additions & 0 deletions solutions/c/anagram/1/anagram.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef ANAGRAM_H
#define ANAGRAM_H
#include <stddef.h>
#define MAX_STR_LEN 20
typedef enum anagram_status { UNCHECKED = -1, NOT_ANAGRAM, IS_ANAGRAM } anagram_status;
struct candidate {
anagram_status is_anagram;
const char *word;
};
struct candidates {
struct candidate *candidate;
size_t count;
};
/**
* @description - determines if any of the words in candidate are anagrams
* for subject. Contents of candidate structures may be modified.
*/
void find_anagrams(const char *subject, struct candidates *candidates);
#endif
15 changes: 15 additions & 0 deletions solutions/c/armstrong-numbers/1/armstrong_numbers.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Dedicated to Shree DR.MDD

#include "armstrong_numbers.h"
#include <math.h>

bool is_armstrong_number(int number) {
int temp = number;
int total = number;
int size = floor(log10(number) + 1);
while (temp) {
total -= pow(temp % 10, size);
temp /= 10;
}
return total == 0;
}
5 changes: 5 additions & 0 deletions solutions/c/armstrong-numbers/1/armstrong_numbers.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifndef ARMSTRONG_NUMBERS_H
#define ARMSTRONG_NUMBERS_H
#include <stdbool.h>
bool is_armstrong_number(int candidate);
#endif
54 changes: 54 additions & 0 deletions solutions/c/atbash-cipher/1/atbash_cipher.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Dedicated to Shree DR.MDD — eternal guidance in code

#include "atbash_cipher.h"
#include "atbash_cipher.h"
#include <ctype.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>

static size_t process_inner(bool insert_space, const char *msg, char *res);

char *atbash_encode(const char *msg) {
size_t sz = process_inner(true, msg, NULL);
char *res = malloc((sz + 1) * sizeof(char));
res[sz] = 0;
process_inner(true, msg, res);
return res;
}

char *atbash_decode(const char *msg) {
size_t sz = process_inner(false, msg, NULL);
char *res = malloc((sz + 1) * sizeof(char));
res[sz] = 0;
process_inner(false, msg, res);
return res;
}

size_t process_inner(bool insert_space, const char *msg, char *res) {
size_t idx = 0;
size_t used = 0;

while (*msg) {
if (isalpha(*msg) || isdigit(*msg)) {
if (insert_space && used && used % 5 == 0) {
if (res) {
res[idx] = ' ';
}
idx++;
}
if (res) {
if (isalpha(*msg)) {
res[idx] = ('z' - tolower(*msg) + 'a');
} else {
res[idx] = *msg;
}
}
used++;
idx++;
}
msg++;
}

return idx;
}
5 changes: 5 additions & 0 deletions solutions/c/atbash-cipher/1/atbash_cipher.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifndef ATBASH_CIPHER_H
#define ATBASH_CIPHER_H
char *atbash_encode(const char *input);
char *atbash_decode(const char *input);
#endif
34 changes: 34 additions & 0 deletions solutions/c/beer-song/1/beer_song.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// for Shree DR.MDD
#include "beer_song.h"
#include "beer_song.h"
#include <stdio.h>

static const char * L1[] = {
"No more bottles of beer on the wall, no more bottles of beer.",
"1 bottle of beer on the wall, 1 bottle of beer.",
"%u bottles of beer on the wall, %u bottles of beer."
};

static const char * L2[] = {
"Go to the store and buy some more, 99 bottles of beer on the wall.",
"Take it down and pass it around, no more bottles of beer on the wall.",
"Take one down and pass it around, 1 bottle of beer on the wall.",
"Take one down and pass it around, %u bottles of beer on the wall."
};

void recite(uint8_t start, uint8_t drop, char **msg) {
uint8_t last = start - (drop - 1);
for (int i = start; i >= last; i--) {
sprintf(*msg++, L1[i > 1 ? 2 : i], i, i);
if (i == 0) {
sprintf(*msg++, L2[0]);
} else if (i == 1) {
sprintf(*msg++, L2[1]);
} else if (i == 2) {
sprintf(*msg++, L2[2]);
} else {
sprintf(*msg++, L2[3], i - 1);
}
msg++;
}
}
5 changes: 5 additions & 0 deletions solutions/c/beer-song/1/beer_song.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifndef BEER_SONG_H
#define BEER_SONG_H
#include <stdint.h>
void recite(uint8_t start_bottles, uint8_t take_down, char **song);
#endif
Loading