Categories

## How I learnt Python versus how I learnt JavaScript

There is a lot of debate regarding what is the best way to learn how to program. Or the best way to learn in general. Should you watch other people do it, like online tutorials? Trial and error by building/trying stuff yourself? A combination of both? In my opinion, there is no formula for learning […]

Categories

## [Coderbyte] – Multiplicative Persistence [Easy]

In this post, we are going to solve a challenge from Coderbyte called Multiplicative Persistence. The challenge is as follows: Have the function MultiplicativePersistence(num) take the num parameter being passed which will always be a positive integer and return its multiplicative persistence which is the number of times you must multiply the digits in num until you reach a single digit. […]

Categories

## [Coderbyte] – Different Cases [Easy]

I was surprised to see that some of my solutions are in top solutions on Coderbyte. The answer to this challenge is the 16th solution in the top 18 solutions. Coming back to the problem, here is what we have to do: Have the function DifferentCases(str) take the str parameter being passed and return it in upper camel case […]

Categories

## [Coderbyte] – H Distance [Easy]

The coding challenge for today is called “H Distance”. In short, this challenge asks us to find the number of characters that are not found in both strings. However, Coderbyte does a better job of explaining the problem: Have the function HDistance(strArr) take the array of strings stored in strArr, which will only contain two strings of equal […]

Categories

## [Coderbyte] – Mean Mode [Easy]

Let’s get back to Coderbyte again. This time we have the “Mean Mode” challenge. The challenge requirements are as follows: Have the function MeanMode(arr) take the array of numbers stored in arr and return 1 if the mode equals the mean, 0 if they don’t equal each other (ie. [5, 3, 3, 3, 1] should return 1 because the mode (3) equals the mean (3)). The array will not […]

Categories

## [Coderbyte] – Letter Changes [Easy]

For today’s article, we have the ‘Letter Changes’ problem. The full description from Coderbyte is below: Have the function LetterChanges(str) take the str parameter being passed and modify it using the following algorithm. Replace every letter in the string with the letter following it in the alphabet (ie. c becomes d, z becomes a). Then capitalize every vowel in this […]

Categories

## [Coderbyte] – Dash Insert [Easy]

This problem asks us to add a dash between each pair of odd numbers in the given string. A more detailed description from Coderbyte: Have the function DashInsert(str) insert dashes (‘-‘) between each two odd numbers in str. For example: if str is 454793 the output should be 4547-9-3. Don’t count zero as an odd number.  The first step is to create a […]

Categories

## [Coderbyte] – Letter Count I [Easy]

This version of letter count is a challenge I have enjoyed solving because I have found a solution shorter and easier to understand than most of the top answers from Coderbyte.  The challenge requirements can be seen below: Have the function LetterCountI(str) take the str parameter being passed and return the first word with the greatest number of repeated […]

Categories

## [Coderbyte] – Powers of Two [Easy]

The challenge description, as it is on Coderbyte: Have the function PowersofTwo(num) take the num parameter being passed which will be an integer and return the string true if it’s a power of two. If it’s not return the string false. For example if the input is 16 then your program should return the string true but if the input is 22 […]

Categories

## [Coderbyte] – Second GreatLow [Easy]

The challenge I have solved recently is called “Second GreatLow”.  The full challenge description, taken from the Coderbyte website, is below: Have the function SecondGreatLow(arr) take the array of numbers stored in arr and return the second lowest and second greatest numbers, respectively, separated by a space. For example: if arr contains [7, 7, 12, 98, 106] the output should be 12 […]