Skip to content

Commit 041aaf1

Browse files
committed
issue haoel#13
1 parent 33c74f2 commit 041aaf1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/zigZagConversion/zigZagConversion.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
using namespace std;
2929

3030
string convert(string s, int nRows) {
31-
if (nRows<=1) return s;
31+
//The cases no need to do anything
32+
if (nRows<=1 || nRows>=s.size()) return s;
3233

3334
vector<string> r(nRows);
3435
int row = 0;

0 commit comments

Comments
 (0)