Skip to content

SibDiP/Codewars_solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codewars_solutions

My codewars solutions written on #python.

Main purpose: tracking progress and easy navigation through solved task examples


Date Kata Theme
2022-11-19 5_kyu_Maximum_subarray_sum Kadane’s Algorithm
2022-11-20 5_kyu_Moving_Zeros_To_The_End Algorithms
2022-11-21 5_kyu_Calculating_with_Functions 1. nonlocal, global var
2. oneliners, lambda
2022-11-24 8_kyu_Find_the_position! 1. oneliner, str.find(), f-string
2. ord(), askii
2022-11-25 5_kyu_Human_Readable_Time 1. f-string oneliner
2. digit formatting {num:dd}
2022-12-01 5_kyu_Rot13 1. ord(), ascii
2. txt.translate(maketrans())
2022-12-03 5_kyu_Pete_the_baker 1. loop, try/except/min()
2. oneliner, get()
2022-12-15 8_kyu_Square(n)_Sum 1. for loop oneliner
2022-12-17 7_kyu_Square_Every_Digit 1. oneliner for loop, .join()
2022-12-22 7_kyu_Jaden_Casing_Strings 1. for loop oneliner, join(), .capitalize(), .split(), .rstrip()
2. same, but this time I figured out about 'SEPORATOR'.join()
2022-12-23 7_kyu_Highest_and_Lowest 1. map(), f-string, max(), min()
2022-12-24 7_kyu_Beginner_Series_#3_Sum_of_Numbers range(), oneliner
2022-12-26 7_kyu_Exes_and_Ohs 1. if-else oneliner, count(), lower()
2. (FC) same but without if/else
3. More readable version
2022-12-27 7_kyu_Growth_of_a_Population 1. while loop, round down by //
2. (FC) addition argument, no round
2022-12-28 8_kyu_Basic_Mathematical_Operations 1 eval(), f-string. eval() with open argument - unsecure practice
2. dict insted of if
2022-12-29 6_kyu_Detect_Pangram 1. for, if, rfind(), chr(), unicode_index
2. (FC) import string, oneliner, set(), issubset(), string.ascii_lowercase
2023-01-29 6_kyu_Array.diff 1. List comprehension, in/not in / for loop
2. (FC) Same but subtrahend list converted to set(). More efficient.
2023-01-29 6_kyu_Replace_With_Alphabet_Position 1. Unicode, ord(), .join(), for/if oneliner
2023-01-30 8_kyu_DNA_to_RNA_Conversion 1. translation() - with dic it takes ASCII id / for loop
2. replace()
2023-02-05 7_kyu_Mumbling 1. for loop oneliner, enumerate(), join(), .capitalize()
2023-03-13 6_kyu_Break_camelCase.py 1. RegEx
2. (FC) RegEx, re.sub()
2023-03-14 6_kyu_Duplicate_Encoder.py 1. collections.Counter()
2023-03-15 5_kyu_Valid_Parentheses.py 1. Two counters algorithm
2. (FC) One counter realisation (much cleaner)
2023-03-16 8_kyu_A_Needle_in_the_Haystack.py 1. f-string, index()
2023-03-18 7_kyu_Isograms.py 1. for, enumerate, O(n^2)
2. (FC) set(). O(n)
2023-03-20 6_kyu_Counting_Duplicates.py 1. dict, two for loops
2. iterator and set()
3. (FC) for loop, seen and dupes sets (nice one)
2023-03-22 7_kyu_Sum_of_two_lowest_positive_integers.py 1. sorted(), sum(), O(n log n)
2. smallest & sec_smallest, for, sum(), O(n)
2023-03-24 8_kyu_Rock_Paper_Scissors.py 1. if-elif-else construction, easy to read
2023-03-30 7_kyu_Get_the_Middle_Character.py 1. if-elif-else, slice
2. (FC) divmod(), if-else oneliner, slice (much better than 1)
2023-04-11 6_kyu_Find_the_odd_int.py 1. collections - Counter, for k,v
2023-04-26 7_kyu_Vowel_Count.py 1. collections.Counter, for loop
2. (FC) sum(), in-for-in oneliner
2023-05-08 8_kyu_Reversed_Strings.py 1. slice [::-1]
2023-05-08 8_kyu_Grasshopper_-_Check_for_factor.py 1. statement %
2. return if else (no need for that. 1 variant did the same thing)
2023-05-09 8_kyu_Remove_exclamation_marks.py 1. .replace()
2023-05-09 8_kyu_Cat_years,_Dog_years.py 1. if * 3
2.

LeetCode

Date File Theme
2022-11-17 06_Remove_Element.py Arrays_101
1. two pointers: fast and slow
2. two pointers (start and end) and swap
2022-11-19 07_Remove_Duplicates_from_Sorted_Array.py Arrays_101
1. two pointers, slow and fast + while loop
2. (FC) One pointer + for loop, pretty close to 1 solvation
2022-11-21 08_Check_If_N_and_Its_Double_Exist.py Arrays_101
1. set(), for, in
2022-11-23 09_Valid_Mountain_Array.py Arrays_101
1. while loop, walk up - walk down
2023-06-02 01_1768._Merge_Strings_Alternately.py LeetCode_75
1. two pointers
2. (FC) zip_longest, list comprehansion, "".join
2023-08-11 02_1071._Greatest_Common_Divisor_of_Strings.py LeetCode_75
1. (My, did't work) max(), min(), for-loop, count()
2. (Editoiral) / Brute Force - prefix check, end-to-start, min(), len()
2023-09-01 03_1431._Kids_With_the_Greatest_Number_of_Candies.py LeetCode_75
1. (My) max(), for-loop, append()
2. (From Comments, much shorter!), max(), generator expression

Releases

No releases published

Packages

No packages published

Languages