Skip to content

Instantly share code, notes, and snippets.

@AndriiBozh
AndriiBozh / CodeWars: find the 1st Python dev.txt
Created February 28, 2019 12:20
CodeWars: find the 1st Python dev
ASSIGNMENT
_______________________
You will be given an array of objects (associative arrays in PHP) representing data about developers
who have signed up to attend the next coding meetup that you are organising.
The list is ordered according to who signed up first.
Your task is to return one of the following strings:
< firstName here >, < country here > of the first Python developer who has signed up; or
@AndriiBozh
AndriiBozh / CodeWars: Is Ruby Coming.txt
Created February 27, 2019 14:18
CodeWars: Is Ruby Coming?
ASSIGNMENT
_______________________
You will be given an array of objects (associative arrays in PHP) representing data about developers
who have signed up to attend the next coding meetup that you are organising.
Your task is to return:
true if at least one Ruby developer has signed up; or
false if there will be no Ruby developers.
_______________________
@AndriiBozh
AndriiBozh / CodeWars: count the numbers of JS devs from Europe.txt
Last active February 27, 2019 13:57
CodeWars: count the numbers of JS devs from Europe
ASSIGNMENT
_____________________________
You will be given an array of objects (hashes in ruby) representing data about developers
who have signed up to attend the coding meetup that you are organising for the first time.
Your task is to return the number of JavaScript developers coming from Europe.
If, there are no JavaScript developers from Europe then your function should return 0.
Notes:
@AndriiBozh
AndriiBozh / CodeWars: add a new property.txt
Created February 27, 2019 13:34
CodeWars: add a new property
ASSIGNMENT
______________________________
You will be given an array of objects (associative arrays in PHP) representing data about developers
who have signed up to attend the next coding meetup that you are organising.
Your task is to return an array where each object will have a new property 'greeting' with the following string value:
Hi < firstName here >, what do you like the most about < language here >?
SOLUTION
______________________________
function greetDevelopers(list) {
@AndriiBozh
AndriiBozh / CodeWars: CamelCase Method.txt
Last active December 8, 2022 11:21
CodeWars: CamelCase Method
ASSIGNMENT
___________________________
Write simple .camelCase method (camel_case function in PHP, CamelCase in C# or camelCase in Java) for strings.
All words must have their first letter capitalized without spaces.
For instance:
"hello case".camelCase() => HelloCase
"camel case word".camelCase() => CamelCaseWord
@AndriiBozh
AndriiBozh / CodeWars: Split CamelCase.txt
Created February 25, 2019 08:27
CodeWars: Split CamelCase
ASSIGNMENT
_______________________________
Split a camelcase string into individual words, the return value must be a single string of words seporated by one whitespace.
The strings are to be split on the capital letters like so:
'StringStringString' => 'String String String'
_______________________________
SOLUTION
_______________________________
function splitter(str){
@AndriiBozh
AndriiBozh / CodeWars: Split and Replace, if Needed.txt
Created February 24, 2019 13:13
CodeWars: Split and Replace, if Needed
ASSIGNMENT
____________________________
Complete the solution so that it splits the string into pairs of two characters.
If the string contains an odd number of characters then it should
replace the missing second character of the final pair with an underscore ('_').
Examples:
solution('abc') // should return ['ab', 'c_']
solution('abcdef') // should return ['ab', 'cd', 'ef']
@AndriiBozh
AndriiBozh / CodeWars: working with subarrays, Bus Stop.txt
Last active February 24, 2019 11:57
CodeWars: working with subarrays, Bus Stop
ASSIGNMENT
_______________________________
There is a bus moving in the city, and it takes and drop some people in each bus stop.
You are provided with a list (or array) of integer arrays (or tuples).
Each integer array has two items which represent number of people get into bus (The first item)
and number of people get off the bus (The second item) in a bus stop.
Your task is to return number of people who are still in the bus after the last bus station (after the last array).
Even though it is the last bus stop, the bus is not empty and some people are still in the bus, and they are probably sleeping there :D
_______________________________
SOLUTION
@AndriiBozh
AndriiBozh / CodeWars: Extract last names of people named Michael.txt
Created February 21, 2019 09:10
CodeWars: Extract last names of people named Michael
ASSIGNMENT
______________________________________________________
Given a text, for example:
const inputText = "Michael, how are you? - Cool, how is John Williamns and Michael Jordan? I don't know but Michael Johnson is fine. Michael do you still score points with LeBron James, Michael Green AKA Star and Michael Wood?";
get an array of last names of people named Michael. The result should be:
["Jordan", "Johnson", "Green", "Wood"]
@AndriiBozh
AndriiBozh / CodeWars: bank deposit years to wait.txt
Created February 20, 2019 22:13
CodeWars: bank deposit years to wait
ASSIGNMENT
__________________________________________________
Mr. Scrooge has a sum of money 'P' that wants to invest, and he wants to know how many years 'Y'
this sum has to be kept in the bank in order for this sum of money to amount to 'D'.
The sum is kept for 'Y' years in the bank where interest 'I' is paid yearly,
and the new sum is re-invested yearly after paying tax 'T'
Note that the principal is not taxed but only the year's accrued interest