Nanosoft Technologies - Chennai Interview Question for Web Developers


Team: EPUB
Country: India
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
0
of 0 vote

var findStr = function(data){
var str = '';
console.log('non repeated number  ' + recursion(str, data));

}

function recursion(str, data){
var temp = data.charAt(0);
var startIndex = data.indexOf(temp);
var tsize = data.length -1;
if(data.length == 0){
return str;
}else{
if(str.indexOf(temp) == -1){
	str = str+temp;
}
return recursion(str, data.slice(++startIndex, tsize));
}
	
}

- Prad121 April 16, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

change this
var tsize = data.length -1;
to
var tsize = data.length;

it will work

- Sai June 16, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

var findStr = function(data){
var str = '';
console.log('non repeated number ' + recursion(str, data));

}

function recursion(str, data){
var temp = data.charAt(0);
var startIndex = data.indexOf(temp);
var tsize = data.length -1;
if(data.length == 0){
return str;
}else{
if(str.indexOf(temp) == -1){
str = str+temp;
}
return recursion(str, data.slice(++startIndex, tsize));
}

}

- prad121 April 16, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

var findStr = function(data){
var str = '';
console.log('non repeated number ' + recursion(str, data));

}

function recursion(str, data){
var temp = data.charAt(0);
var startIndex = data.indexOf(temp);
var tsize = data.length -1;
if(data.length == 0){
return str;
}else{
if(str.indexOf(temp) == -1){
str = str+temp;
}
return recursion(str, data.slice(++startIndex, tsize));
}

}

- pradeep.121.eng April 16, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

<script>

var str = "xxxyyyzzz";
var Mainstrng = "";

var count = 0;
for (var i = 0; i < str.length; i++) {

count = 0;

for (var j = i + 1; j < str.length; j++) {
if (str[j] == str[i]) {

count++;
break;

}

}
if (count == 0) {

Mainstrng += str[i];
}
}
alert(Mainstrng);
</script>

- Mohit April 16, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

var str = "xxxyyyzzz";
var Mainstrng = "";
var count = 0;
for (var i = 0; i < str.length; i++) {

count = 0;

for (var j = i + 1; j < str.length; j++) {
if (str[j] == str[i]) {

count++;
break;

}

}
if (count == 0) {

Mainstrng += str[i];
}
}
alert(Mainstrng);

- Mohit April 16, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

var str = "xxxyyyzzz";
var Mainstrng = "";
var count = 0;
for (var i = 0; i < str.length; i++) {
count = 0;
for (var j = i + 1; j < str.length; j++) {
if (str[j] == str[i]) {
count++;
break;
}
}
if (count == 0) {
Mainstrng += str[i];
}
}

- Mohit April 16, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

var str = "xxxyyyzzz";
var Mainstrng = "";
var count = 0;
for (var i = 0; i < str.length; i++) {
count = 0;
for (var j = i + 1; j < str.length; j++) {
if (str[j] == str[i]) {
count++;
break;}}
if (count == 0) {
Mainstrng += str[i];}}
alert(Mainstrng);

- Anonymous April 16, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

var str = "xxxyyyzzz";
var Mainstrng = "";
var count = 0;
for (var i = 0; i < str.length; i++) {
count = 0;
for (var j = i + 1; j < str.length; j++) {
if (str[j] == str[i]) {
count++;
break;}}
if (count == 0) {
Mainstrng += str[i];}}
alert(Mainstrng);

- Mohit April 16, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

function RemoveDuplicates(str, index)
{
	if(index == str.length)
		return "";

	var first = str.charAt(index);
	for(var i = index; i < str.length ; i++)
	{
		if(str.charAt(i) != first)
		{
			return first + RemoveDuplicates(str, i);
		}
	}

        // Last char of the sequence
        return first;
}

- Nelson Perez April 16, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

public class RemoveDup {
	static String temp="";
	public static void main(String args[]){		
		String a = "xxxyyyyzzzz";
		System.out.println(fun(a));
	}

 static String fun(String a) {
	 if(a.length()>0){
	 CharSequence c = a.subSequence(0, 1);
	 if(!temp.contains(c))
		 temp += c.toString();
	 fun(a.substring(1));
	 }	
		return temp;
 }	
}

- lavankumar01 April 16, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

var x = "xxyxzabeezz";

function removeDuplicate(data, value){
var value = value? value : "";
if(data && data.length>1)
{
for(var i in data){
if(value.indexOf(data[i])==-1){
value += data[i];
}else{
removeDuplicate(data[i], value);
}
}
return value;
}
}

console.log(removeDuplicate(x));

- Anonymous April 17, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

var x = "xxyxzabeezz";
function removeDuplicate(data, value){
    var value = value? value : "";
    if(data && data.length>1)
    {
        for(var i in data){
            if(value.indexOf(data[i])==-1){
                value += data[i];
            }else{
                removeDuplicate(data[i], value);
            }
        }
        return value;
    }
}
console.log(removeDuplicate(x));

- Anonymous April 17, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

var x = "xxyxzabeezz";
function removeDuplicate(data, value){
    var value = value? value : "";
    if(data && data.length>1)
    {
        for(var i in data){
            if(value.indexOf(data[i])==-1){
                value += data[i];
            }else{
                removeDuplicate(data[i], value);
            }
        }
        return value;
    }
}
console.log(removeDuplicate(x));

- Anonymous April 17, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

var x="xxxyxzabezz";
function removeDuplicate(data, value){
var value = value ? value : "";
if(data && data.length>1){
for(var i in data){
	if(value.indexOf(data[i])!=-1){
value+=data[i];
} else {
removeDuplicate(data[i], value);
}
}
}
return value;
}
console.log(removeDuplicate(x));

- Anonymous April 17, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

var x="xxxyxzabezz";
function removeDuplicate(data, value){
var value = value ? value : "";
if(data && data.length>1){
for(var i in data){
	if(value.indexOf(data[i])!=-1){
value+=data[i];
} else {
removeDuplicate(data[i], value);
}
}
}
return value;
}
console.log(removeDuplicate(x));

- Raj April 17, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

function removeDuplicates(S, i, set, solution){
    if (i === S.length){
        return solution;
    }
    else {
       c = S[i];

       if (!set[c]){
           set[c] = true;
           return removeDuplicates(S, i + 1, set, solution + c);
       }
       else {
           return removeDuplicates(S, i + 1, set, solution);
       }
    }
}

removeDuplicates("xxxxxyyyyzz", 0, {}, "")

- inucoder April 19, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

a='xxxyyyzzz'
b='';
for(var i =0; i<a.length; i++){
if(b.indexOf(a.charAt(i)) === -1){
b=b+a.charAt(i);
}
}
return b;

- Rahul Ranjan June 08, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

function removeDuplicates(word, start){
 
  if(word==null){
    console.log("input is incorrect");
    return;
  }

  if(word.length==0){
    console.log("Wrong input, blank word");
    return;
  }
  
  if(start==word.length){
    console.log('finished here');
    return word;
  }
  
  var charLooked = word.charAt(start);
  var restOfWord = word.substring(start+1, word.length);
  if(restOfWord.indexOf(charLooked)==-1){
    return removeDuplicates(word,start+1);
  }
  
  var i;
  
  for(i = start+1; i<word.length; i++){
    if(word.charAt(i)==charLooked){
      word = word.substring(0, i-1) + word.substring(i, word.length);
      if(word.indexOf(charLooked)==-1){
        return removeDuplicates(word, start+1);
      }
      else return removeDuplicates(word, start);
    }
  }

}

- Federico July 15, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

function removeDuplicates(word, start){
 
  if(word==null){
    console.log("input is incorrect");
    return;
  }

  if(word.length==0){
    console.log("Wrong input, blank word");
    return;
  }
  
  if(start==word.length){
    console.log('finished here');
    return word;
  }
  
  var charLooked = word.charAt(start);
  var restOfWord = word.substring(start+1, word.length);
  if(restOfWord.indexOf(charLooked)==-1){
    return removeDuplicates(word,start+1);
  }
  
  var i;
  
  for(i = start+1; i<word.length; i++){
    if(word.charAt(i)==charLooked){
      word = word.substring(0, i-1) + word.substring(i, word.length);
      if(word.indexOf(charLooked)==-1){
        return removeDuplicates(word, start+1);
      }
      else return removeDuplicates(word, start);
    }
  }
  
}

- Federico July 15, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

function replaceIt(str){
      if(str == ""){
          return '';
      }
      var char = str.charAt(0);
      str = str.substr(1).replace(new RegExp(char,"g"),'');
      return char+replaceIt(str);
}

- Gautam October 08, 2016 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More