62.Given a number N and an array of N strings, find if two consecutive words are same.
Input Size : N <= 1000
Sample Testcase :
INPUT
5
code
overload
vishal
sundar
anish
OUTPUT
no
ONE TESTCASE PASSED
const readline = require("readline");
const inp = readline.createInterface({
input: process.stdin
});
const userInput = [];
inp.on("line", (data) => {
userInput.push(data);
});
inp.on("close", () => {
var ans;
var N = Number(userInput[0]);
for(i=1;i<=N;i++)
{if(userInput[i]===(userInput[i+1]))
{ans= "yes";
return;}
else
{ans="no"}}
console.log(ans)
});
Input Size : N <= 1000
Sample Testcase :
INPUT
5
code
overload
vishal
sundar
anish
OUTPUT
no
ONE TESTCASE PASSED
const readline = require("readline");
const inp = readline.createInterface({
input: process.stdin
});
const userInput = [];
inp.on("line", (data) => {
userInput.push(data);
});
inp.on("close", () => {
var ans;
var N = Number(userInput[0]);
for(i=1;i<=N;i++)
{if(userInput[i]===(userInput[i+1]))
{ans= "yes";
return;}
else
{ans="no"}}
console.log(ans)
});
Comments
Post a Comment