Padding list within lists
With[{n = Max[Length /@ list]}, PadRight[#, n, Last @ #] & /@ list]
PadRight[list, Automatic, list[[All, {-1}]]]
{{1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {1, 6, 6}, {1, 4, 4}, {1, 3, 5}, {1, 3, 2}}
The 3rd argument can also be Take[list, All, -1]
.
Clear[pad]
pad = Function[list,
PadRight[#, Max[Length /@ list], Last@#] & /@ list
];
pad@{{1}, {1}, {1}, {1, 6}, {1, 4}, {1, 3, 5}, {1, 3, 2}}