Skip to content

Commit 2775a81

Browse files
committed
Write problems in markdown.
1 parent 80c38a5 commit 2775a81

File tree

2 files changed

+32
-11
lines changed

2 files changed

+32
-11
lines changed

CONTRIBUTING.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ Thanks!
2727
question: """
2828
Write a function called add that takes two numbers and returns their sum, e.g.:
2929
30-
add(1, 2) #=> 3
30+
```elixir
31+
add(1, 2) #=> 3
32+
```
3133
""",
3234
solution: """
3335
def add(x, y) do

config/problems.exs

+29-10
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ config :problems,
6363
question: """
6464
Write a concat function that takes two strings(binaries) and concantenates them, e.g:
6565
66-
concat("foo", "bar") #=> "foobar"
66+
```elixir
67+
concat("foo", "bar") #=> "foobar"
68+
```
6769
""",
6870
solution: """
6971
def concat(word1, word2) do
@@ -80,7 +82,10 @@ config :problems,
8082
number: 005,
8183
question: """
8284
Write a function palindrome? that checks if a given string is a palindrome, A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward. e.g
83-
palindrome?("madam") #=> true
85+
86+
```elixir
87+
palindrome?("madam") #=> true
88+
```
8489
""",
8590
solution: """
8691
def palindrome?(word) do
@@ -99,7 +104,10 @@ config :problems,
99104
number: 006,
100105
question: """
101106
Write a function anagram? that checks if two given strings are anagrams, An anagram is a type of word play, the result of rearranging the letters of a word or phrase to produce a new word or phrase, using all the original letters exactly once
107+
108+
```elixir
102109
anagram?("rose", "sore") #=> true
110+
```
103111
""",
104112
solution: """
105113
def anagram?(word1, word2) do
@@ -120,7 +128,9 @@ config :problems,
120128
question: """
121129
Write an extract_bytes function that takes a binary and a non-negative integer and extracts the number of bytes specified by the integer, e.g:
122130
123-
extract_bytes(<<102, 111, 111, 32, 98, 97, 114, 0, 0, 0, 1>>, 4) #=> "foo "
131+
```elixir
132+
extract_bytes(<<102, 111, 111, 32, 98, 97, 114, 0, 0, 0, 1>>, 4) #=> "foo "
133+
```
124134
""",
125135
solution: """
126136
def extract_bytes(bin, int) do
@@ -139,8 +149,10 @@ config :problems,
139149
question: """
140150
Write a find_missing_char function that takes a same case alphabetical char list and returns the missing char if there is one otherwise returns nil, e.g:
141151
142-
find_missing_char('ZCGBMHFJYTODIUQARVEWPLNKX') #=> ?S
143-
find_missing_char('abcdefghijklmnopqrstuvwxyz') #=> nil
152+
```elixir
153+
find_missing_char('ZCGBMHFJYTODIUQARVEWPLNKX') #=> ?S
154+
find_missing_char('abcdefghijklmnopqrstuvwxyz') #=> nil
155+
```
144156
""",
145157
solution: """
146158
def find_missing_char(xs) do
@@ -168,8 +180,11 @@ config :problems,
168180
%Problem{
169181
number: 009,
170182
question: """
171-
Write a checksum function, that computes a parity byte checksum of a string (http://en.wikipedia.org/wiki/Checksum#Parity_byte_or_parity_word), e.g:
172-
checksum("Elixir is fun.") #=> 95
183+
Write a checksum function, that computes a [parity byte](http://en.wikipedia.org/wiki/Checksum#Parity_byte_or_parity_word) checksum of a string, e.g:
184+
185+
```elixir
186+
checksum("Elixir is fun.") #=> 95
187+
```
173188
""",
174189
solution: """
175190
use Bitwise
@@ -196,7 +211,9 @@ config :problems,
196211
question: """
197212
Write a function join that takes a tuple(with elements that of type String, Integer, Float, Atom, CharList) and a separator and returns a string of the elements of the tuple joined by the separator, e.g:
198213
199-
join({1,2,3}, " ") #=> "1 2 3"
214+
```elixir
215+
join({1,2,3}, " ") #=> "1 2 3"
216+
```
200217
""",
201218
solution: """
202219
def join(tuple, separator) do
@@ -214,8 +231,10 @@ config :problems,
214231
question: """
215232
Given a list of strings, return a list of list of strings of anagrams, i.e. each element of the returned list is a list of words that are anagrams among them, e.g:
216233
217-
input = ["stars", "mary", "rats", "tars", "army", "banana"]
218-
anagrams(input) #=> [["rats", "tars"], ["army", "mary"], ["stars"], ["banana"]]
234+
```elixir
235+
input = ["stars", "mary", "rats", "tars", "army", "banana"]
236+
anagrams(input) #=> [["rats", "tars"], ["army", "mary"], ["stars"], ["banana"]]
237+
```
219238
""",
220239
solution: """
221240
def anagrams(input) do

0 commit comments

Comments
 (0)