Anonymous
BAN USERReal quick coder...only basics
- -1of 1 vote
Answerswrite a program that will analyse the string....
- Anonymous in India
char str[90]="my brother is taller than me@1233334. I always a short man,but smart than him";
1)Remove spaces between words,
2)Find the longest word in the String,
3)Search and count the number of letters"e" in the string 4)Extact the number of integers in string
5)Extract the number of doubles in string
6)Extract the number of words in string
7)Identify the number of sentences in the String.| Report Duplicate | Flag | PURGE
Athena Health Applications Developer - 0of 0 votes
Answerswrite a program that will analyse the string....
- Anonymous in India
char str[90]="my brother is taller than me@1233334. I always a short man,but smart than him";
1)Remove spaces between words,
2)Find the longest word in the String,
3)Search and count the number of letters"e" in the string 4)Extact the number of integers in string
5)Extract the number of doubles in string
6)Extract the number of words in string
7)Identify the number of sentences in the String.| Report Duplicate | Flag | PURGE
Athena Health Applications Developer - 3of 3 votes
AnswersHere is a good puzzle:
- Anonymous in United States
How do you write a program which produces its own source code as output?| Report Duplicate | Flag | PURGE
Microsoft Front-end Software Engineer - 0of 0 votes
AnswersFind the word in the given sentence.
- Anonymous in United States
i)Check whether it exists
ii)If exist means return count and index.
Ex:
string="CSK lost to RR"
substr="CSK"
CSK exist in above string.The substr CSK is presented at the index of 0-2 in string.
The count is 1.| Report Duplicate | Flag | PURGE
Developer Program Engineer - 1of 9 votes
AnswersGiven a string say "ABCD". Now create a new string with duplicates of each character in the original string and append the reverse of the same string (with duplicates) excluding the last character.
- Anonymous in India
First iteration: AABBCCCCBBAA
[ABC three types of chars; Here c is the last char.Ignore duplicates after the last char c]
Second iteration: AABBBBAA
[here b is the last char]
Third iteration: AAAA
[no second char left]| Report Duplicate | Flag | PURGE
Microsoft Testing / Quality Assurance - -1of 1 vote
AnswersPrint 010101010.... or 1010101010... without using arithmatic operations.
- Anonymous in United States| Report Duplicate | Flag | PURGE
Informatica Software Engineer / Developer - -1of 3 votes
AnswersGiven a string Sting="ABCSC" Check whether it contains a Substring="ABC"?
- Anonymous in India
1)If no , return "-1".
2)If yes , remove the substring from string and return "SC".
use very simple code and concept(ALGORITHM)..| Report Duplicate | Flag | PURGE
Facebook Front-end Software Engineer - 3of 13 votes
AnswersPrint the numbers between 30 to 3000.
- Anonymous in United States
CONSTRAINT:
The numbers shouldnt contain digits either in incresing order or decreasing order.
FOLLOWING NOT ALLOWED
##123,234,345,1234,2345##increasing order,
##32,21,321,432,3210 etc##decresing order.
FOLLOWING ALLOWED:
243,27,578,2344 etc.,
Now see who ll code ths....| Report Duplicate | Flag | PURGE
Microsoft Developer Program Engineer - 0of 2 votes
Answers###Print numbers between 45 to 4578 without repeating digits.###
- Anonymous in India
Ex: 45-ALLOWED;55(repeatng digits)(-NOT ALLOWED. Frnd tld ths 2 me.he tried diff concepts but interviewer wanted an OPTIMAL ONE..LETS C WHO WRITE THIS WITH SIMPLE LOGIC..| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test - 0of 2 votes
AnswersUse SIMPLE LOGIC for Converting this string str="aaabbccc" into str="3a2b3c".
- Anonymous in United States
###Note:###
I gave 3 diff solutions to interviewer with loops,conditions etc.,But he wanted a real OPTIMAL SOLUTION..lets see who ll write!!!!!| Report Duplicate | Flag | PURGE
Amazon Developer Program Engineer - -3of 5 votes
AnswersFind out the sum of diagonals of matrix(here 2 diagonals)
- Anonymous in United States
###Any1 having Better solution?pls i really need this
WITH ALGORITHM (step by step) fr my interview.###
Constraint:
u should use the middle element only once..
matrix
1 2 3
4 5 6
7 8 9
Here 1st diagonal is 1+5+9=15
2nd diagonal is 3+shouldn't repeat(5)+7=15...| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer - -2of 2 votes
Answers##Pretty much interested question asked in AMAZON Written test##
- Anonymous in India
Take a string, store it as digits; str="678876". Now Check if the given str return TWO EQUAL PARTS with equal sum (6+7+8=8+7+6);if it is correct then replace the str(678876) in the new string, str1="12345876678"
Final output should be: "12345678876"
I tried this ..but the interviewer didnt satisfy..| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test - -1of 3 votes
Answers##NEVER SKIP THIS QUESTION..ASKED IN AMAZON###
- Anonymous in India
Take THREE arrays,like arr1={1,3,5,7,9}; arr2={1,2,3,5,4,1,8,9,7};arr3={1,3,5,7,9,2,1,4,6,5,8};Now find out the Duplicates of First two(arr1,arr2) arrays and store it in new another array arr4(should contain only duplicates,no unique elements).Now compare arr3 with arr4.You should return only UNIQUE elements from both of the array.If found, return it, else return -1.| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test - -1of 1 vote
Answersstr="AB0CD1010" this s a string consider it as a counter variable n increment it
- Anonymous in India
for example the next element should be "AB0CD1011"
Note: If anyone know the answer fr ths ques well,pls post with full code and ALGORITHM(for beginners)...| Report Duplicate | Flag | PURGE
Amazon Front-end Software Engineer - -2of 2 votes
AnswersAdd the ODD ORDERED elements in a matrix.But the intersecting(middle) element must be added only once.
- Anonymous in India
Ex:
467
932
148
in this matrix 4,7,3,1,8 are odd indexed or odd ordered elements;We have to add them but,
###constraint ###
intersecting(middle) element must be added(used) only once.| Report Duplicate | Flag | PURGE
Amazon Applications Developer C - -1of 1 vote
AnswersPgm to compare two strings..Their we have to compare
- Anonymous in United States
i) first char at first time.
ii) second char at second time
iii)third char at third time..so on..
My code is : for(i=0;i<str[i].length();i++)//str1
{
for(j=0;j<str[j].length();j++)//str2
if(str[i].charAt(i)==str.charAt(j))
{
printf("yes");
}
else{
printf("false");
}}}
Any more suggestions?| Report Duplicate | Flag | PURGE
Adap.tv Developer Program Engineer - -2of 2 votes
AnswersPrint our name in pascal triangle..
- Anonymous in India
ex:anony| Report Duplicate | Flag | PURGE
Adap.tv Developer Program Engineer - -1of 1 vote
AnswersAdd the diagonal elements of a square matrix (of odd order say 3*3,5*5) but the intersecting element must be added only once.
- Anonymous in Australia
Sorry for my poor english..That what i understood from interviewer..| Report Duplicate | Flag | PURGE
Accenture Front-end Software Engineer
PROPER CODE AND OUTPUT:
import java.io.*;
public class Anonymous{
public static void main(String[] args){
char[] str = {'a','b','c','d','e'};
int i = str.length-2;
while(i >=0)
{
char tmp = str[i];
str[i] = str[i +1];
str[i+1] = tmp;
i--;
}
System.out.println(str);
}}
OUTPUT:
eabcd
CODE FOR SEARCHING ,COUNTING,INDEX OF SUBSTR IN STR:
import java.io.*;
public class Subbu{
public static void main(String args[]){
String str = "CSK lost to RR";
String subString = "CSK";
int i,count;
for(i = 0 ; i < str.length(); ++i) {
if(str.charAt(i) == subString.charAt(i)) {
count=++i;
System.out.println("yes,str contains substr and also substr found at index of "+ count);
}
else{
System.out.println("no, str doesnt contains substr");
}}}}
OUTPUT:
yes,str contains substr and also substr found at index of 1
yes,str contains substr and also substr found at index of 3
It s very easy ques..i dnt knw y amazon askng these knd of ques?
Anyway i m gng 2 ans ths..
int a[]={2,3,4,-5,-4,4,6}
constraint :
subarray sum shld be equal to zero ;But we dnt knw where the subarray present in array.
so use TRAVERSING METHOD..
1)Pick one starting element i;and j=i+1;
2)So,iterate through the array for more elements i,i+1 etc.,
3)now compare the subarray with elements
if(arr[i]==sum)//means arr[i]==0;
sample code:
//starting point
for (i = 0; i < n; i++)
{
subarray_sum = arr[i];
for (j = i+1; j <= n; j++)
{
if (subarray_sum == sum)
{
printf ("Sum found between indexes %d and %d", i, j-1);
return 1;
}
refer this..
RepAnonymous, Applications Developer at A9
Real quick coder...only basics
RepPriscillaRYoung, Aghori Mahakal Tantrik at Absolute Softech Ltd
Hi, I am Priscilla from California. I am working as a Business management consultant in Quality Merchant Services company. I ...
Repsallieroliphant, Project Leader at Wissen Technology
With years of experience I can guarantee you that our licensed company specializes in furnace maintenance scarborough, air conditioners and ...
Repnyladsomerville, abc
Want to purchase best quality silencer at affordable price manufactured by top most trusted brand Innovative Arms.
Contact Stonefirearms now!
I think ,THIS WORKS..ALGORITHM:
- Anonymous October 28, 20131)Do reverse of each row..like the following for this
i/p:
XWV
UTS
RQP
o/p:
VWX
STU
PQR
2)Do swap the first and last row only..keep the middle one as it as..
so the desired output is..
i/p:
VWX
STU
PQR
o/p:
PQR
STU
VWX i thnk ths is gonna works..wait fr code..i m thnking,,,,,,