public int stringMatch(String a, String b)
{
int match = 0;
int x = 0;
int y = 2;
String aa = a.substring(x,y);
String bb = b.substring(x,y);
...
Type: Posts; User: espltdf100
public int stringMatch(String a, String b)
{
int match = 0;
int x = 0;
int y = 2;
String aa = a.substring(x,y);
String bb = b.substring(x,y);
...
The new code is:
public int stringMatch(String a, String b)
{
int match = 0;
int x = 0;
int y = 2;
String aa = a.substring(x,y);
String bb =...
It no longer returns all 0s, but I still don't recieve the expected answer.
The tests are:
stringMatch("xxcaazz", "xxbaaz") → expected 3, got 4
stringMatch("abc", "abc") → expected 2, got...
My bad.
The new code after using the equals method is:
public int stringMatch(String a, String b)
{
int match = 0;
int x = 0;
int y = 2;
Though my code compiles, it returns all 0's, and I don't understand why.
The problem I have to answer is :
Given 2 strings, a and b, return the number of the positions where they contain the...