Vertically flip the grid and concatenate with original.
Output = reversed rows + original rows
- Reverse the row order of the input grid (
g[::-1]) - Concatenate with the original grid (
+ g)
solve=lambda g:g[::-1]+g| Trick | Description | Savings |
|---|---|---|
[::-1] |
Python slice reversal - no function call needed | N/A |
+ |
List concatenation - builds result directly | N/A |
| Lambda | Single expression, no return keyword | 7 bytes |
| Version | Bytes | Change |
|---|---|---|
| Initial lambda | 24 | solve=lambda g:g[::-1]+g |
This task has a nearly optimal solution:
- The operation is a single Python expression
- No per-element processing needed
- Slice reversal
[::-1]is extremely concise - List concatenation
+is a single character
At 24 bytes, this is likely near the theoretical minimum for this task.