How to Replace Characters with Alphabet Positions in Python
The challenge
Given a string, replace every letter with its position in the alphabet.
If anything in the text isn’t a letter, ignore it and …
Read Article →In-depth guides, insights, and best practices for modern software engineering
Given a string, replace every letter with its position in the alphabet.
If anything in the text isn’t a letter, ignore it and …
Read Article →You are given a string of space-separated numbers and have to return the highest and lowest number.
Example:
high_and_low("1 2 3 4 …
Read Article →
Implement a difference function, which subtracts one list from another and returns the result.
It should remove all values from list a, …
In this challenge, your function receives an array of integers as input. Your task is to determine whether the numbers are in ascending …
Read Article →Given a string, capitalize the letters that occupy even indexes and odd indexes separately, and return as shown below. Index `` will be …
Read Article →Create a method IsUpperCase to see whether the string is ALL CAPS. For example:
type MyString string
MyString("c").IsUpperCase() …
Read Article →
In Go, there are multiple ways to make a string UpperCase, each of them are by using the strings package.
strings.ToUpper):func ToUpper(str …
Given a string of words, return the length of the shortest word(s).
The input string will never be empty and you do not need to account …
Read Article →Given an integer numRows, return the first numRows of Pascal’s triangle.
In Pascal’s triangle, each number is the sum of the …
Read Article →Your goal is to return multiplication table for number that is always an integer from 1 to 10.
For example, a multiplication table …
Read Article →Remove the left-most duplicates from a list of integers and return the result.
// Remove the 3's at indices 0 and 3
// followed by …
Read Article →
All we eat is water and dry matter.
John bought potatoes: their weight is 100 kilograms. Potatoes contain water and dry matter.
The …
Read Article →The input is a string str of digits. Cut the string into chunks (a chunk here is a substring of the initial string) of size sz (ignore …
Coroutines are a way to handle multithreading in Kotlin, read more about it from the official docs: …
Read Article →val pair: Pair<String, Int> = "myKey" to 2
A utility class when you want to return 2 values that are not related …
Read Article →Given a month as an integer from 1 to 12, return to which quarter of the year it belongs as an integer number.
For example: month 2 …
Read Article →Create a function that takes 2 nonnegative integers in form of a string as an input, and outputs the sum (also as a string):
Example: ( …
Read Article →If you have gotten this error before, then you have been trying to implement a rowData mapping onto Ag-Grid.. and failed!
ImmutableService requires …
If you have accidentally committed the wrong files into Git, but haven’t yet pushed it to the server, you can recover, or undo your commit as …
Read Article →There are times when you need to extract an object into a number of variables.
Let’s take the example below:
val (id, name, position, …
Read Article →
Everyone knows passphrases. One can choose passphrases from poems, songs, movies names and so on but frequently they can be guessed due …
Read Article →Unit corresponds to the void keyword in Java.
Unit in Kotlin?If you have a function that does not return a value, you can return a Unit …
Functions are reusable pieces of code, often called Blocks, that as the name suggests, act as building blocks to piece together a program.
Each …
Read Article →Among all the many keywords that Kotlin comes with, there exists val and var. What are they used for? What are the differences, and why would you use …