Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(n) {
- if( n === 3) {
- for(let i = 0; i < n; i++) {
- console.log('+' + '-'.repeat(n - 2) + '+' + '-'.repeat(n - 2) + '+');
- }
- } else {
- for(let i = 0; i < n - 1; i++) {
- console.log('+' + '-'.repeat(n - 2) + '+' + '-'.repeat(n - 2) + '+');
- if(i === 2) {
- break;
- }
- for(j = 0; j < Math.floor((n - 3) / 2); j++) {
- console.log('|' + ' '.repeat(n - 2) + '|' + ' '.repeat(n - 2) + '|');
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement