6. ZigZag Conversion

字符串處理。首先要知道題意,如圖: 思路: 可以設立numRows(行數)個vector,然後按給出的字符串順序遍歷,模擬整個過程,走到哪一行就將該字符的下標插入vector中,最後按行輸出即可。 class Solution { public:     string convert(string s, int numRows) {         vector<int> num[100000];
相關文章
相關標籤/搜索