As reported: Salesforce SMTS loop (Dec 2025), tech round 1 (60 minutes, two questions): print a string in zigzag over a given number of rows, then the phone keypad letter combinations.
This is LeetCode 6 — Zigzag Conversion.
Write the string s in a zigzag on numRows rows: go down the rows one character at a time, then diagonally back up, and repeat. Then read the rows from top to bottom and return the result.
Example 1
s = "PAYPALISHIRING", numRows = 3
Output: "PAHNAPLSIIGYIR"
P A H N
A P L S I I G
Y I R
Example 2
s = "PAYPALISHIRING", numRows = 4
Output: "PINALSIGYAHRPI"
Example 3
s = "A", numRows = 1
Output: "A"
Constraints: 1 ≤ s.length ≤ 1000; s holds English letters, ',' and '.'; 1 ≤ numRows ≤ 1000.
Code runner format: one JSON value per line: s, then numRows. Implement convert(s, numRows); the harness prints the string.