Skip to main content

CONCEPTS -1

2. Rahul is given a task to manipulate a string, He hired you as a developer your task is to delete all the repeating characters and print the result left. CHECK WITH 4

Sample Input :
mississipie
Sample Output :
mpe
 
 
 
3.You are given a string.Your task is to print only the consonants present
 in the string without affecting the sentence spacings if present. If no
 consonants are present print -1
 
Sample Input :
I am shrey 
Sample Output :
 m shry
 
 
4. You are given a number with duplicate digits your task is to remove the immediate duplicate digits and print the result
Sample Input :
1331
Sample Output :
11
 
 
9.you are given a string made up of parenthesis only.Your task is to check
 whether parenthesis are balanced or not.If they are balanced print 1 
else print 0 

Sample Input :
{({})}
Sample Output :
1
 
 

10.Joyal was given a sentence. His task is to delete the two words that comes together and print the sentence so that the words in the output sentence have distinct words compared to their adjacent words. If no words are present in the output sentence print -1
Input Description:
You are given input string 'S'
Output Description:
Print the all the words that are left in the string 's' so that the words in the output sentence have distinct words compared to their adjacent words. Print -1 if no words are left
Sample Input :
I am john cena cena john
Sample Output :
I am
 

Comments

Popular posts from this blog

In XYZ country there is rule that car’s engine no. depends upon car’ number plate. Engine no is sum of all the integers present on car’s Number plate.The issuing authority has hired you in order to provide engine no. to the cars.Your task is to develop an algorithm which takes input as in form of string(Number plate) and gives back Engine number.

In XYZ country there is rule that car’s engine no. depends upon car’ number plate. Engine no is sum of all the integers present on car’s Number plate.The issuing authority has hired you in order to provide engine no. to the cars.Your task is to develop an algorithm which takes input as in form of string(Number plate) and gives back Engine number. const readline = require('readline');  const inp = readline.createInterface({   input: process.stdin  });  const userInput = [];  inp.on("line", (data) => {  userInput.push(data);  });  inp.on("close", () => {  var data = userInput[0].split(" ");  var a = (data);  var b=data.join('');  var c=b.split("").map(val=>Number(val))  var sum=0;  for(i=0;i<c.length;i++)  {d=c[i]  if(isNaN (d))  sum =sum;  else  sum= sum+d  }   console.log(sum)  });

Given a string S, print 'yes' if it has a vowel in it else print 'no'. Sample Testcase : INPUT codekata OUTPUT yes

Given a string S, print 'yes' if it has a vowel in it else print 'no'. Sample Testcase : INPUT codekata OUTPUT yes const readline = require('readline');  const inp = readline.createInterface({   input: process.stdin  });  const userInput = [];  inp.on("line", (data) => {  userInput.push(data);  });  inp.on("close", () => {  var data = userInput[0].split(" ");  var a = String(data[0]);  var b=a.split("")  var v;  var count=false  for(v of b) {  if(v == "a" || v == "e" || v == "i" || v == "o" || v == "u" || v == "A" || v == "E" || v == "I" || v == "O" || v == "U")  count=true }  if(count)  console.log('yes')  else  console.log('no') });  

You are given a number with duplicate digits your task is to remove the immediate duplicate digits and print the result

You are given a number with duplicate digits your task is to remove the immediate duplicate digits and print the result Sample Input : 1331 Sample Output : 11     const readline = require('readline'); const inp = readline.createInterface({ input: process.stdin }); const userInput = []; inp.on("line", (data) => { userInput.push(data); }); inp.on("close", () => { var data = userInput[0].split(" "); var a = (data); var b=data.join(' '); var c=b.split("") for(i=0;i<c.length;i++) {if(c[i]==c[i+1]) c.splice(i,2) } d=c.join("") console.log(d) });