Está en la página 1de 2

1.

Given an array of ints, we'll say that a triple is a value appearing 3 times in
a row in the array. Return true if the array does not contain any triples.
noTriples({1, 1, 2, 2, 1}) -> false
noTriples({1, 1, 2, 2, 2, 1}) -> true
noTriples({1, 1, 1, 2, 2, 2, 1}) -> true
2.
Given an array of ints, return the number of times that two 6's are next to each
other in the array. Also count instances where the second "6" is actually a 7.
array667({6,
array667({6,
array667({6,
array667({1,

6,
6,
7,
6,

2}) ->
2, 6})
2, 6})
6, 6})

1
-> 1
-> 1
-> 2

3.
Given an array of 4 integers [a,b,c,d] representing two points (a, b) and (c, d)
,
return a string representation of the slope of the line joining these two points
.
For an undefined slope (division by 0), return undefined . Note that the "undefi
ned" is case-sensitive.
Assume that [a,b,c,d] and the answer are all integers (no floating numbers!). Sl
ope: https://en.wikipedia.org/wiki/Slope
4.
Given 2 strings, a and b, return the number of the positions where they contain
the same length 2 substring. So "xxcaazz" and "xxbaaz" yields 3, since the "xx",
"aa", and "az" substrings appear in the same place in both strings.
stringMatch("xxcaazz", "xxbaaz") -> 3
stringMatch("abc", "abc") -> 2
stringMatch("abc", "axc") -> 0
5.
Given a non-empty string like "Code" return a string like "CCoCodCode".
stringSplosion("Code") -> "CCoCodCode"
stringSplosion("abc") -> "aababc"
stringSplosion("ab") -> "aab"
6.
Return a version of the given array where each zero value in the array is replac
ed by the largest odd value to the right of the zero in the array. If there is n
o odd value to the right of the zero, leave the zero as a zero.
zeroMax({0, 5, 0, 3}) -> {5, 5, 3, 3}
zeroMax({0, 4, 0, 3}) -> {3, 4, 3, 3}
zeroMax({0, 1, 0}) -> {1, 1, 0}
7.
The goal of this exercise is to convert a string to a new string where each char
acter in the new string is '(' if that character appears only once in the origin
al string, or ')' if that character appears more than once in the original strin

g. Ignore capitalization when determining if a character is a duplicate.


Examples:
"din" => "((("
"recede" => "()()()"
"Success" => ")())())"
"(( @" => "))(("
8.
Everyone knows passphrases. One can choose passphrases from poems, songs, movies
names and so on but frequently they can be guessed due to common cultural refer
ences. You can get your passphrases stronger by different means. One is the foll
owing:
Choose a text in capital letters including or not digits and non alphabetic char
acters,
Shift each letter by a given number but the transformed letter must be a
letter (circular shift),
Replace each digit by its complement to 9,
Keep such as non alphabetic and non digit characters,
Downcase each letter in odd position, upcase each letter in even positio
n (the first character is in position 0),
Reverse the whole result.
Example:
Your text: "BORN IN 2015!", shift 1
1 + 2 + 3 -> "CPSO JO 7984!"
4 "CpSo jO 7984!"
5 "!4897 Oj oSpC"
9.
Your task is to sort a given string. Each word in the String will contain a sing
le number. This number is the position the word should have in the result.
Note: Numbers can be from 1 to 9. So 1 will be the first word (not 0).
If the input String is empty, return an empty String. The words in the input Str
ing will only contain valid consecutive numbers.
For an input: "is2 Thi1s T4est 3a" the function should return "Thi1s is2 3a T4es
t"
10. 2 D array sorting