Competetive Programming Practice on CodeWars
One of the best place to practice your coding skill
About Codewar
Codewars is a platform that helps you learn, train, and improve your coding skills by solving programming tasks of many types and difficulty levels. You choose how you would like to learn. Do you want to take on increasingly difficult challenges? Maybe you prefer training through repetition and by improving your solutions. After solving a task, compare your answer with other users and learn from them, or help less experienced users by answering their questions.
Walkthrough of Codewars
Codewars getting popular for their beginner-friendly environment and expert competitors. As a beginner journey of programming world, this would be the nicest place to improve my programming skills and push it further to the next level.
Here’s some problems that i’ve solved along the way……..
Questions
This time no story, no theory. The examples below show you how to write function accum
:
Examples:
|
|
The parameter of accum is a string which includes only letters from a..z
and A..Z
.
Your task is to make a function that can take any non-negative integer as an argument and return it with its digits in descending order. Essentially, rearrange the digits to create the highest possible number.
Examples:
input: 42145 Output: 54421
Input: 145263 Output: 654321
Input: 123456789 Output: 987654321
Write a function that accepts an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form of a phone number.
Examples:
create_phone_number([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) # => returns "(123) 456-7890"
The returned format must be correct in order to complete this challenge. Don’t forget the space after the closing parentheses!
An isogram is a word that has no repeating letters, consecutive or non-consecutive. Implement a function that determines whether a string that contains only letters is an isogram. Assume the empty string is an isogram. Ignore letter case.
Examples:
|
|
A square of squares
You like building blocks. You especially like building blocks that are squares. And what you even like more, is to arrange them into a square of square building blocks!
However, sometimes, you can’t arrange them into a square. Instead, you end up with an ordinary rectangle! Those blasted things! If you just had a way to know, whether you’re currently working in vain… Wait! That’s it! You just have to check if your number of building blocks is a perfect square.
Tasks:
Given an integral number, determine if it’s a square number:
In mathematics, a square number or perfect square is an integer that is the square of an integer; in other words, it is the product of some integer with itself.
The tests will always use some integral number, so don’t worry about that in dynamic typed languages.
Examples:
|
|
In this kata you are required to, given a string, replace every letter with its position in the alphabet.
If anything in the text isn’t a letter, ignore it and don’t return it.
"a" = 1
, "b" = 2
, etc.
Examples:
alphabet_position("The sunset sets at twelve o' clock.")
Should return "20 8 5 19 21 14 19 5 20 19 5 20 19 1 20 20 23 5 12 22 5 15 3 12 15 3 11"
(as a string)
Jaden Smith, the son of Will Smith, is the star of films such as The Karate Kid (2010) and After Earth (2013). Jaden is also known for some of his philosophy that he delivers via Twitter. When writing on Twitter, he is known for almost always capitalizing every word. For simplicity, you’ll have to capitalize each word, check out how contractions are expected to be in the example below.
Your task is to convert strings to how they would be written by Jaden Smith. The strings are actual quotes from Jaden Smith, but they are not capitalized in the same way he originally typed them.
Examples:
|
|
Link to Jaden’s former Twitter account @officialjaden via archive.org
You get an array of numbers, return the sum of all of the positives ones.
Examples [1,-4,7,12] =>
1 + 7 + 12 = 20
Note: if there is nothing to sum, the sum is default to 0
.
Simple, given a string of words, return the length of the shortest word(s).
String will never be empty and you do not need to account for different data types.
In this kata you will create a function that takes a list of non-negative integers and strings and returns a new list with the strings filtered out.
Examples:
|
|
Answers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
YouTube
Here’s the youtube video of this post