Tugas
Diberikan elemen pembungkus dan array 3D yang tidak bergerigi, bungkus array atas, bawah, dan semua-sekitar. Anda harus menangani data karakter dan numerik, tetapi pembungkus dan sekarang akan memiliki tipe data yang sama.
Contoh karakter
Untuk data karakter, Anda dapat memilih untuk menangani array 3D karakter tunggal atau array string 2D:
Diberikan array karakter 2 layer, 2 baris, 4 kolom
[[["Y","o","u","r"],
["g","i","f","t"]],
[["g","o","e","s"],
["h","e","r","e"]]]
dan karakter "."
, jawab array karakter 4 layer, 4 baris, 6 kolom
[[[".",".",".",".",".","."],
[".",".",".",".",".","."],
[".",".",".",".",".","."],
[".",".",".",".",".","."]],
[[".",".",".",".",".","."],
[".","Y","o","u","r","."],
[".","g","i","f","t","."],
[".",".",".",".",".","."]],
[[".",".",".",".",".","."],
[".","g","o","e","s","."],
[".","h","e","r","e","."],
[".",".",".",".",".","."]],
[[".",".",".",".",".","."],
[".",".",".",".",".","."],
[".",".",".",".",".","."],
[".",".",".",".",".","."]]]
atau diberi 2 baris, 2 larik kolom string 4-karakter
[["Your",
"gift"],
["goes",
"here"]]
dan karakter "."
, jawab deretan 4 baris, 4 kolom string 6-karakter
[["......",
"......",
"......",
"......"],
["......",
".Your.",
".gift.",
"......"],
["......",
".goes.",
".here.",
"......"],
["......",
"......",
"......",
"......"]]
Contoh numerik
Diberikan 2 layer, 2 baris, 2 array numerik kolom
[[[1,2],
[3,4]],
[[5,6],
[7,8]]]`
dan nomornya 0
, jawab larik numerik 4 layer, 4 baris, 4 kolom
[[[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]],
[[0,0,0,0],
[0,1,2,0],
[0,3,4,0],
[0,0,0,0]],
[[0,0,0,0],
[0,5,6,0],
[0,7,8,0],
[0,0,0,0]],
[[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]]]