Skip to content

hapepo23/codewars-c-challenges

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

152 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My solutions to Codewars challenges - programmed in C.

C

badge


A word of warning

If you really want to learn C and improve through the challenges, don't just copy my solutions. You won't learn anything that way! (Cheating and plagiarizing is not permitted on the Codewars website. Violators will face account suspension or ban.)


My solutions to some Codewars challenges, programmed in C, might not be the most sophisticated, but at least mostly easy to read and understand. However, a few are implemented rather poorly.

Current C rank (since February 1, 2026): 2 kyu.


See also:


!! Security Notice !!

The code I released here into the public domain may appear in third-party projects. I do not maintain, endorse, or have any affiliation with such projects. Any malicious or deceptive use is unauthorized and should be reported to the hosting platform.


List of all challenges I solved in C

  1. <1 kyu> 7×7 Skyscrapers - Solution: skyscrapers_7x7_puzzle.c
  2. <2 kyu> 6 By 6 Skyscrapers - Solution: skyscrapers_6x6_puzzle.c
  3. <2 kyu> Evaluate mathematical expression - Solution: eval_math_expression.c
  4. <2 kyu> Integer Square Root - Solution: integer_sqrt.c
  5. <2 kyu> Optical character recognition - Solution: ocr.c
  6. <2 kyu> Simpler Interactive Interpreter - Solution: simpler_interactive_interpreter.c
  7. <3 kyu> Divide integers as strings - Solution: divide_number_strings.c
  8. <3 kyu> Last digit of a huge number - Solution: last_digit_of_huge_number.c
  9. <3 kyu> Make a spiral - Solution: make_spiral.c
  10. <3 kyu> Prime Streaming (PG-13) - Solution: prime_streaming.c
  11. <4 kyu> 4 By 4 Skyscrapers - Solution: skyscrapers_4x4_puzzle.c
  12. <4 kyu> Adding Big Numbers - Solution: adding_big_numbers.c
  13. <4 kyu> Counting Change Combinations - Solution: counting_change_combinations.c
  14. <4 kyu> Escape the maze - Solution: escape_the_maze.c
  15. <4 kyu> Explosive Sum - Solution: explosive_sum.c
  16. <4 kyu> Human readable duration format - Solution: format_duration.c
  17. <4 kyu> Large Factorials - Solution: large_factorials.c
  18. <4 kyu> Matrix Determinant - Solution: determinant.c
  19. <4 kyu> Multiplying numbers as strings - Solution: multiply_number_strings.c
  20. <4 kyu> Next bigger number with the same digits - Solution: next_bigger_number.c
  21. <4 kyu> Next smaller number with the same digits - Solution: next_smaller_number_with_same_digits.c
  22. <4 kyu> Number of Proper Fractions with Denominator d - Solution: number_proper_fractions.c
  23. <4 kyu> Ordered set - Solution: ordered_set.c
  24. <4 kyu> parseInt() reloaded - Solution: parseint-reloaded.c
  25. <4 kyu> Range Extraction - Solution: range_extraction.c
  26. <4 kyu> Ranking Poker Hands - Solution: ranking_poker_hands.c
  27. <4 kyu> Rectangle Rotation - Solution: rectangle_rotation.c
  28. <4 kyu> Roman Numerals Helper - Solution: roman_num_helper.c
  29. <4 kyu> Snail - Solution: snail_sort.c
  30. <4 kyu> Square into Squares. Protect trees! - Solution: square_into_squares.c
  31. <4 kyu> Strings Mix - Solution: strings_mix.c
  32. <4 kyu> Sum of Intervals - Solution: sum_of_intervals.c
  33. <4 kyu> Sum Strings as Numbers - Solution: sum_number_strings.c
  34. <4 kyu> The observed PIN - Solution: the_observed_pin.c
  35. <5 kyu> Base64 Encoding - Solution: base64.c
  36. <5 kyu> Base64 Numeric Translator - Solution: base64_numeric_translator.c
  37. <5 kyu> Beeramid - Solution: beeramid.c
  38. <5 kyu> Big Integer Modulo - Solution: big_integer_modulo.c
  39. <5 kyu> Blackjack Scorer - Solution: blackjack_scorer.c
  40. <5 kyu> Common Denominators - Solution: common_denominators.c
  41. <5 kyu> Convert A Hex String To RGB - Solution: hex_string_to_rgb.c
  42. <5 kyu> Count IP Addresses - Solution: count_ip_addresses.c
  43. <5 kyu> Directions Reduction - Solution: directions_reduction.c
  44. <5 kyu> Factorial decomposition - Solution: factorial_decomposition.c
  45. <5 kyu> First Variation on Caesar Cipher - Solution: first_variation_on_caesar_cipher.c
  46. <5 kyu> Formula 1 Race - Solution: formula1_race.c
  47. <5 kyu> Grab CSV Columns - Solution: grab_csv_columns.c
  48. <5 kyu> Greed is Good - Solution: greed_is_good.c
  49. <5 kyu> Human Readable Time - Solution: human_readable_time.c
  50. <5 kyu> int32 to IPv4 - Solution: int32_to_ipv4.c
  51. <5 kyu> ISBN-10 Validation - Solution: is_valid_ISBN_10.c
  52. <5 kyu> Josephus Permutation - Solution: josephus_permutation.c
  53. <5 kyu> Josephus Survivor - Solution: josephus_survivor.c
  54. <5 kyu> Land perimeter - Solution: land_perimeter.c
  55. <5 kyu> Last digit of a large number - Solution: last_digit_of_large_number.c
  56. <5 kyu> Least Common Multiple - Solution: least_common_multiple.c
  57. <5 kyu> Maximum subarray sum - Solution: maximum_subarray_sum.c
  58. <5 kyu> Mean Square Error - Solution: mean_square_error.c
  59. <5 kyu> Merged String Checker - Solution: merged_string_checker.c
  60. <5 kyu> Moving Zeros To The End - Solution: move_zeros.c
  61. <5 kyu> Not very secure - Solution: not_very_secure.c
  62. <5 kyu> Number of trailing zeros of N! - Solution: factorial_trailing_zeros.c
  63. <5 kyu> Parsing goto statements - Solution: parsing_goto_statements.c
  64. <5 kyu> ■□ Pattern □■ : Zoom - Solution: pattern_zoom.c
  65. <5 kyu> Perimeter of squares in a rectangle - Solution: fibonacci_squares_perimeter.c
  66. <5 kyu> Primes in numbers - Solution: prime_factor_decomposition.c
  67. <5 kyu> Product of consecutive Fib numbers - Solution: product_consecutive_fibnum.c
  68. <5 kyu> Rational Arithmetic - Solution: rational_arithmetic.c
  69. <5 kyu> (Ready for) Prime Time - Solution: prime_time.c
  70. <5 kyu> Return substring instance count - 2 - Solution: substring_instance_count.c
  71. <5 kyu> RGB To Hex Conversion - Solution: rgb_to_hex.c
  72. <5 kyu> ROT13 - Solution: rot13.c
  73. <5 kyu> Rotate an array matrix - Solution: rotate.c
  74. <5 kyu> Scramblies - Solution: scramble.c
  75. <5 kyu> Snakes and Ladders - Solution: snakes_and_ladders.c
  76. <5 kyu> Sort - one, three, two - Solution: sort_one_three_two.c
  77. <5 kyu> Square Matrix Multiplication - Solution: square_matrix_multiplication.c
  78. <5 kyu> String incrementer - Solution: string_incrementer.c
  79. <5 kyu> Strings: implement your own "strtok" function! - Solution: my_strtok.c
  80. <5 kyu> The Clockwise Spiral - Solution: clockwise_spiral.c
  81. <5 kyu> Tic-Tac-Toe Checker - Solution: tic_tac_toe_checker.c
  82. <5 kyu> Value of x - Solution: value_of_x.c
  83. <5 kyu> Weight for weight - Solution: weight_for_weight.c
  84. <5 kyu> Write out numbers - Solution: write_out_numbers.c
  85. <5 kyu> Write your own printf - Solution: your_own_printf.c
  86. <5 kyu> Zonk game - Solution: zonk_game.c
  87. <6 kyu> Array.diff - Solution: array_diff.c
  88. <6 kyu> Array Exchange - Solution: array_exchange.c
  89. <6 kyu> Ascend, Descend, Repeat? - Solution: ascend_descend_repeat.c
  90. <6 kyu> Assemble string - Solution: assemble_string.c
  91. <6 kyu> Backspaces in string - Solution: strclr.c
  92. <6 kyu> Bit Counting - Solution: bit_counting.c
  93. <6 kyu> Bomb has been planted! - Solution: bomb_has_been_planted.c
  94. <6 kyu> Break camelCase - Solution: break_camelcase.c
  95. <6 kyu> Build Tower - Solution: build_tower.c
  96. <6 kyu> CamelCase Method - Solution: string_to_camel_case.c
  97. <6 kyu> Canal Management - Solution: canal_management.c
  98. <6 kyu> Cantor's pairing function - Solution: cantor_pairing_function.c
  99. <6 kyu> Can You OOP in C? - Information Hiding - Solution: oop_in_c_information_hiding.c
  100. <6 kyu> Cogs Gearnetwork - Solution: cogs_gearnetwork.c
  101. <6 kyu> Convert ISBN-10 to ISBN-13 - Solution: convert_isbn10_to_isbn13.c
  102. <6 kyu> Count characters in your string - Solution: count_characters.c
  103. <6 kyu> Counting Duplicates - Solution: counting_duplicates.c
  104. <6 kyu> C overloading - Solution: c_overloading.c
  105. <6 kyu> Create Phone Number - Solution: create_phone_number.c
  106. <6 kyu> Cuckoo Clock - Solution: cuckoo_clock.c
  107. <6 kyu> Decode the Morse code - Solution: decode_morse.c
  108. <6 kyu> Derivatives of type x^n - Solution: derivatives.c
  109. <6 kyu> Detect Pangram - Solution: detect_pangram.c
  110. <6 kyu> Determine the date by the day number - Solution: determine_date_by_day_number.c
  111. <6 kyu> Does my number look big in this? - Solution: narcissistic.c
  112. <6 kyu> Drawing English Ruler - Solution: drawing_english_ruler.c
  113. <6 kyu> Equal Sides Of An Array - Solution: equal_sides_of_array.c
  114. <6 kyu> Evaluate the Group of Parentheses - Solution: parentheses_score.c
  115. <6 kyu> Find the odd int - Solution: find_the_odd_int.c
  116. <6 kyu> Find The Parity Outlier - Solution: find_parity_outlier.c
  117. <6 kyu> Find the unique number - Solution: find_the_unique_number.c
  118. <6 kyu> Floating powers of two - Solution: floating_powers_of_two.c
  119. <6 kyu> For whom the Bell tolls - Solution: for_whom_the_bell_tolls.c
  120. <6 kyu> Fruit Machine - Solution: fruit_machine.c
  121. <6 kyu> Fun with lists: countIf - Solution: fun_with_lists_countif.c
  122. <6 kyu> Fun with lists: filter - Solution: fun_with_lists_filter.c
  123. <6 kyu> Fun with lists: map - Solution: fun_with_lists_map.c
  124. <6 kyu> How many pages in a book? - Solution: how_many_pages_in_a_book.c
  125. <6 kyu> IP Validation - Solution: is_valid_ip.c
  126. <6 kyu> Irreducible Sum of Rationals - Solution: irreducible_sum_of_rationals.c
  127. <6 kyu> Is a number prime? - Solution: is_prime.c
  128. <6 kyu> Letter triangles - Solution: letter_triangles.c
  129. <6 kyu> Locate P using 3 Points and their distances to P - Solution: trilateration_2d.c
  130. <6 kyu> Matrix Addition - Solution: matrix_addition.c
  131. <6 kyu> Matrix Transpose - Solution: transpose_matrix.c
  132. <6 kyu> Missing Angle - Solution: missing_angle.c
  133. <6 kyu> Multiples of 3 or 5 - Solution: multiples_of_3_or_5.c
  134. <6 kyu> Multiplication table - Solution: multiplication_table.c
  135. <6 kyu> Non-even substrings - Solution: non_even_substrings.c
  136. <6 kyu> Replace With Alphabet Position - Solution: alphabet_position.c
  137. <6 kyu> Reverse a singly-linked list - Solution: reverse_linked_list.c
  138. <6 kyu> Roman Numerals Decoder - Solution: decode_roman.c
  139. <6 kyu> Roman Numerals Encoder - Solution: roman_num_encoder.c
  140. <6 kyu> Rotate matrix counter - clockwise N - times! - Solution: rotate_matrix_counter_clockwise.c
  141. <6 kyu> Run-length encoding - Solution: run_length_encoding.c
  142. <6 kyu> Sentence Calculator - Solution: letters_to_numbers.c
  143. <6 kyu> Simple card game - Solution: simple_card_game.c
  144. <6 kyu> Simple time difference - Solution: simple_time_difference.c
  145. <6 kyu> Singly Linked List - Swap Nodes - Solution: singly_linked_list_swap_nodes.c
  146. <6 kyu> Sort the odd - Solution: sort_the_odd.c
  147. <6 kyu> Stop gninnipS My sdroW! - Solution: spin_words.c
  148. <6 kyu> Sum of Digits / Digital Root - Solution: digital_root.c
  149. <6 kyu> Take a Ten Minutes Walk - Solution: ten_minutes_walk.c
  150. <6 kyu> Telepathy - Solution: telepathy.c
  151. <6 kyu> The area between the vertex of the parabola and x-axis - Solution: area_between_vertex_of_parabola_and_x_axis.c
  152. <6 kyu> The Deaf Rats of Hamelin - Solution: the_deaf_rats_of_hamelin.c
  153. <6 kyu> The lost beginning - Solution: the_lost_beginning.c
  154. <6 kyu> Transform To Prime - Solution: transform_to_prime.c
  155. <6 kyu> T.T.T.17: Split odd and even - Solution: split_odd_and_even.c
  156. <6 kyu> Two Sum - Solution: two_sum.c
  157. <6 kyu> Valid Braces - Solution: valid_braces.c
  158. <6 kyu> WeIrD StRiNg CaSe - Solution: weird_string_case.c
  159. <6 kyu> Well efficiency calculator - Solution: well_efficiency_calculator.c
  160. <6 kyu> Which day of the week does this date fall on? - Solution: find_date.c
  161. <6 kyu> Who likes it? - Solution: who_likes_it.c
  162. <6 kyu> Word a10n (abbreviation) - Solution: word_a10n.c
  163. <6 kyu> Write Number in Expanded Form - Solution: expanded_form.c
  164. <6 kyu> Your order, please - Solution: order_words.c
  165. <6 kyu> zipWith - Solution: zip_with.c
  166. <7 kyu> Adding Arrays - Solution: adding_arrays.c
  167. <7 kyu> Alphabetically ordered - Solution: is_ordered.c
  168. <7 kyu> Anagram Detection - Solution: is_anagram.c
  169. <7 kyu> Array Leaders - Solution: array_leaders.c
  170. <7 kyu> Binary Addition - Solution: binary_addition.c
  171. <7 kyu> Categorize New Member - Solution: categorize_new_member.c
  172. <7 kyu> Chain me - Solution: chain_me.c
  173. <7 kyu> Color to Grayscale - Solution: color_to_grayscale.c
  174. <7 kyu> Combining Ratios - Solution: combining_ratios.c
  175. <7 kyu> Consecutive Vowels in a String - Solution: get_the_vowels.c
  176. <7 kyu> Count all the sheep on farm in the heights of New Zealand - Solution: count_lost_sheep.c
  177. <7 kyu> Count of codepoints in a UTF-8 string - Solution: count_codepoints.c
  178. <7 kyu> Credit Card Mask - Solution: maskify.c
  179. <7 kyu> Deodorant Evaporator - Solution: evaporator.c
  180. <7 kyu> Find the calculation type - Solution: find_the_calculation_type.c
  181. <7 kyu> Find the median - Solution: find_the_median.c
  182. <7 kyu> Find the next perfect square! - Solution: next_perfect_square.c
  183. <7 kyu> First Fibonacci - Solution: first_fibonacci.c
  184. <7 kyu> Form The Minimum - Solution: form_the_minimum.c
  185. <7 kyu> From A to Z - Solution: from_a_to_z.c
  186. <7 kyu> Fun with lists: anyMatch + allMatch - Solution: fun_with_lists_anymatch_allmatch.c
  187. <7 kyu> Fun with lists: indexOf - Solution: fun_with_lists_indexof.c
  188. <7 kyu> Fun with lists: lastIndexOf - Solution: fun_with_lists_lastindexof.c
  189. <7 kyu> Fun with lists: length - Solution: fun_with_lists_length.c
  190. <7 kyu> Get the Middle Character - Solution: get_middle_character.c
  191. <7 kyu> Highest and Lowest - Solution: high_and_low.c
  192. <7 kyu> How Many Lonely Letters? - Solution: how_many_lonely_letters.c
  193. <7 kyu> Is this a triangle? - Solution: is_triangle.c
  194. <7 kyu> Jaden Casing Strings - Solution: jaden_casing_strings.c
  195. <7 kyu> Maximum Gap - Solution: maximum_gap.c
  196. <7 kyu> Maximum Product - Solution: maximum_product.c
  197. <7 kyu> Maximum Triplet Sum - Solution: maximum_triplet_sum.c
  198. <7 kyu> Mew Cipher - Solution: mew_cipher.c
  199. <7 kyu> Minimize Sum Of Array - Solution: minimize_sum_of_array.c
  200. <7 kyu> Nth Smallest Element - Solution: nth_smallest_element.c
  201. <7 kyu> Product Array - Solution: product_array.c
  202. <7 kyu> Product Of Maximums Of Array - Solution: product_of_maximums_of_array.c
  203. <7 kyu> Quadrant Split Sum - Solution: quadrant_split_sum.c
  204. <7 kyu> Retrieve The N-th String Term - Solution: retrieve_nth_string_term.c
  205. <7 kyu> Return pyramids - Solution: return_pyramids.c
  206. <7 kyu> Reverse words - Solution: reverse_words.c
  207. <7 kyu> Row Weights - Solution: row_weights.c
  208. <7 kyu> Shortest direction on circle - Solution: shortest_direction_on_circle.c
  209. <7 kyu> Simple string reversal II - Solution: reverse_between.c
  210. <7 kyu> Sort Numbers - Solution: sort_numbers.c
  211. <7 kyu> Square Every Digit - Solution: square_digits.c
  212. <7 kyu> Stalin Sort - Solution: stalin_sort.c
  213. <7 kyu> String ends with? - Solution: string_ends_with.c
  214. <7 kyu> Sum of two lowest positive integers - Solution: sum_two_smallest_numbers.c
  215. <7 kyu> TV Remote - Solution: tv_remote.c
  216. <7 kyu> Two to One - Solution: longest.c
  217. <7 kyu> Vowel Count - Solution: get_count.c
  218. <8 kyu> Area of a Square - Solution: area_of_a_square.c
  219. <8 kyu> Convert a string to an array - Solution: convert_string_to_array.c
  220. <8 kyu> Difference of Volumes of Cuboids - Solution: cuboids_volumes_difference.c
  221. <8 kyu> DNA to RNA Conversion - Solution: dna_to_rna_conversion.c
  222. <8 kyu> Do I get a bonus? - Solution: bonus_time.c
  223. <8 kyu> Grasshopper - Summation - Solution: grasshopper_summation.c
  224. <8 kyu> Reversed Strings - Solution: string_reverse.c
  225. <8 kyu> Was the package received before it was sent? - Solution: was_package_received_yesterday.c