Anirudh
BAN USER- 2of 2 votes
AnswersGiven a String with print all the possible combinations of the all the characters in the string as a string for Example
- Anirudh in India
"abc" is the input the you should print the below:
abc
ab
ac
a
bc
b
c
There is one invisible string which is actually a blank string.| Report Duplicate | Flag | PURGE
Komli Media SDET Java - 0of 0 votes
AnswersGiven a string that contains exactly a single pair of parenthesis, return parenthesis and their contents, so "xyz(abc)123" yields "(abc)". etc.
- Anirudh in India
Conditions:
1)No variable allowed
2)Collections not allowed
3)Regex, String.indexOf() not allowed.| Report Duplicate | Flag | PURGE
Ibibo Software Engineer / Developer - 0of 0 votes
AnswersGiven a string that contains exactly a single pair of parenthesis, return parenthesis and their contents, so "xyz(abc)123" yields "(abc)". etc.
- Anirudh in India
Condition: You are not allowed to use a variable anywhere, Regex is not allowed.| Report Duplicate | Flag | PURGE
Ibibo Software Engineer / Developer Java - 0of 0 votes
AnswersGiven a string that contains exactly a single pair of parenthesis, return parenthesis and their contents, so "xyz(abc)123" yields "(abc)". etc.
- Anirudh in India
Condition: You are not allowed to use a variable anywhere.| Report Duplicate | Flag | PURGE
Ibibo Software Engineer / Developer Java - 0of 0 votes
AnswersWrite a Method in Java which takes an Array of strings and from the array of strings returns only those strings which have a consecutive repetition of a particular letter for eg: if I/P is {"Dauresselam", "slab", "fuss", "boolean", "clap"}
- Anirudh in United States
then O/P should be {"Dauresselam", "fuss", "boolean"}| Report Duplicate | Flag | PURGE
Ibibo Testing / Quality Assurance Arrays
public static void printDoorsOpenedOrClosed(int passes)
{
HashMap<Integer, Boolean> doors=new HashMap<Integer, Boolean>();
int i = 0;
//Open all doors as default in the start
while(i < passes)
{
doors.put(i, false);
i++;
}
for(int j = 1; j <= passes; j++)
{
for(int k = j - 1; k < passes; k += j)
doors.put(k, !(doors.get(k)));
}
for(int l = 0; l < passes; l++)
{
System.out.println("The door number "+(l + 1)+" is "+(doors.get(l) == true ? "Opened" : "Closed"));
}
}
I think there are 2 ways to look at it....
1)The method C has different signatures in interface A, B
2)The method C has the same signature in both A, B
Now in the 1st case obviously class C will have to implement 2 methods one that has the signature in A and the other that has signature in B...So obviously in this case the method C has different identities and Class C will be implementing both separately.
and in the second case as the signatures will be identical so it doesnt really matter if it belongs to A or B...it will be one method anyway with a concrete body.
Common sense! Lol
So you have to return a string array as well. I tried with the below solution i know it's not perfect or polished from a purist p.o.v kinda didn't help me get in LoL:
import java.util.Scanner;
public class doubleChars {
public static String[] getDoubles(String[]In)
{
int inLen=In.length;
String zoom[]=new String[inLen];
int count=0;
if(inLen==0)
{
return zoom;
}
for(int i=0;i<=inLen-1;i++)
{
String A=In[i];
//System.out.println(A);
int striLen=A.length();
for(int j=0;j<striLen-1;j++)
{
if(A.substring(j, j+1).equals(A.substring(j+1, j+2)))
{
zoom[count]=A;
count++;
break;
}
}
}
return zoom;
}
public static void main(String[] args)
{
char more='y';
int ab=0;
String[] res={};
String[] fillMe={"durres", "murres", "", "abcdeee", "boolean", "nger", "lagger"};
Scanner strobe=new Scanner(System.in);
System.out.println("Please enter the arraye of the string");
/*while(strobe.hasNext())
{
fillMe[ab]=strobe.next();
ab++;
}
*/
res=doubleChars.getDoubles(fillMe);
for(int k=0;k<res.length;k++)
{
if(res[k]==null)
{
break;
}
System.out.println(res[k]);
}
}
}
Is this puzzle solvable if
- Anirudh April 10, 20151)All the men are taller than him?
2)All the men are shorter than him?