Elixir: Immutability
🚧 In development
Instructions
🚧 In development
If you've reached a deadlock it's time to ask your question in the «Discussions». How ask a question correctly:
- Be sure to attach the test output, without it it's almost impossible to figure out what went wrong, even if you show your code. It's complicated for developers to execute code in their heads, but having a mistake before their eyes most probably will be helpful.
Elixir: Immutability
🚧 In development
Instructions
🚧 In development
If you've reached a deadlock it's time to ask your question in the «Discussions». How ask a question correctly:
- Be sure to attach the test output, without it it's almost impossible to figure out what went wrong, even if you show your code. It's complicated for developers to execute code in their heads, but having a mistake before their eyes most probably will be helpful.
Your exercise will be checked with these tests:
defmodule Test do
use ExUnit.Case
import Solution
test "encode/decode" do
assert encode(~c"Hello", 10) |> decode(10) == ~c"Hello"
assert encode(~c"12345", 1) == ~c"23456"
assert decode(~c"12345", 1) == ~c"01234"
assert encode(~c"abcdef", 2) == ~c"cdefgh"
assert decode(~c"abcdef", 2) == ~c"_`abcd"
end
test "encode/decode with cyrillic symbols" do
assert encode(~c"Привет", 10) |> decode(10) == ~c"Привет"
assert encode(~c"Привет мир", 500) |> decode(500) == ~c"Привет мир"
end
endTeacher's solution will be available in:
20:00
