refactor: Renamed js to nodejs
- feat: Added util module
This commit is contained in:
@@ -25,6 +25,7 @@ Y A H R
|
||||
P I
|
||||
*/
|
||||
|
||||
const { assert } = require('../../util/js');
|
||||
/**
|
||||
* @param {string} s
|
||||
* @param {number} numRows
|
||||
@@ -95,7 +96,8 @@ let s, numRows;
|
||||
|
||||
s = 'PAYPALISHIRING';
|
||||
numRows = 3;
|
||||
console.log(convert(s, numRows));
|
||||
sol = 'PAHNAPLSIIGYIR';
|
||||
assert(convert(s, numRows) == sol, 'Output: "PAHNAPLSIIGYIR"');
|
||||
|
||||
/* Test Case 2
|
||||
* Input: s = "PAYPALISHIRING", numRows = 4
|
||||
@@ -103,7 +105,8 @@ console.log(convert(s, numRows));
|
||||
*/
|
||||
s = 'PAYPALISHIRING';
|
||||
numRows = 4;
|
||||
console.log(convert(s, numRows));
|
||||
sol = 'PINALSIGYAHRPI';
|
||||
assert(convert(s, numRows) == sol, 'Output: "PINALSIGYAHRPI"');
|
||||
|
||||
/* Test Case 3
|
||||
* Input: s = "AB", numRows = 1
|
||||
@@ -111,4 +114,5 @@ console.log(convert(s, numRows));
|
||||
*/
|
||||
s = 'AB';
|
||||
numRows = 1;
|
||||
console.log(convert(s, numRows));
|
||||
sol = 'AB';
|
||||
assert(convert(s, numRows) == sol, 'Output: "AB"');
|
Reference in New Issue
Block a user