Skip to content

Commit 9b95989

Browse files
sync transpose (#567)
1 parent da1e096 commit 9b95989

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

exercises/practice/transpose/.meta/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
},
2020
"blurb": "Take input text and output it transposed.",
2121
"source": "Reddit r/dailyprogrammer challenge #270 [Easy].",
22-
"source_url": "https://www.reddit.com/r/dailyprogrammer/comments/4msu2x/challenge_270_easy_transpose_the_input_text"
22+
"source_url": "https://web.archive.org/web/20230630051421/https://old.reddit.com/r/dailyprogrammer/comments/4msu2x/challenge_270_easy_transpose_the_input_text/"
2323
}

exercises/practice/transpose/.meta/tests.toml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
# This is an auto-generated file. Regular comments will be removed when this
2-
# file is regenerated. Regenerating will not touch any manually added keys,
3-
# so comments can be added in a "comment" key.
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
411

512
[404b7262-c050-4df0-a2a2-0cb06cd6a821]
613
description = "empty string"
@@ -34,3 +41,6 @@ description = "rectangle"
3441

3542
[b80badc9-057e-4543-bd07-ce1296a1ea2c]
3643
description = "triangle"
44+
45+
[76acfd50-5596-4d05-89f1-5116328a7dd9]
46+
description = "jagged triangle"

exercises/practice/transpose/transpose_spec.lua

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,5 +193,24 @@ describe('transpose', function()
193193

194194
assert.are.equal(expected, transpose(input))
195195
end)
196+
197+
it('should transpose a jagged triangle', function()
198+
local input =
199+
'11\n' ..
200+
'2\n' ..
201+
'3333\n' ..
202+
'444\n' ..
203+
'555555\n' ..
204+
'66666'
205+
local expected =
206+
'123456\n' ..
207+
'1 3456\n' ..
208+
' 3456\n' ..
209+
' 3 56\n' ..
210+
' 56\n' ..
211+
' 5'
212+
213+
assert.are.equal(expected, transpose(input))
214+
end)
196215
end)
197216
-- LuaFormatter on

0 commit comments

Comments
 (0)