File tree Expand file tree Collapse file tree
exercises/practice/transpose Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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}
Original file line number Diff line number Diff line change 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 ]
613description = " empty string"
@@ -34,3 +41,6 @@ description = "rectangle"
3441
3542[b80badc9-057e-4543-bd07-ce1296a1ea2c ]
3643description = " triangle"
44+
45+ [76acfd50-5596-4d05-89f1-5116328a7dd9 ]
46+ description = " jagged triangle"
Original file line number Diff line number Diff 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 )
196215end )
197216-- LuaFormatter on
You can’t perform that action at this time.
0 commit comments