Avatar of robdijo
robdijoFlag for United States of America

asked on 

Java Programming Question

Given 2 strings, a and b, return the number of the positions where they
contain the same length 2 substring. So "xxcaazz" and "xxbaaz" yields 3,
since the "xx", "aa" and "az" substring appear in the same place in
strings.

stringMatch("xxcaazz","xxbaaz") -> 3

stringMatch("abc", "abc") -> 2

stringMatch("abc", "axc") -> 0

public int stringMatch(String a, String b)
{
     write code???
}
Java

Avatar of undefined
Last Comment
CEHJ
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Post the code you've written and we'll help with it. We don't write classwork for people
Avatar of robdijo
robdijo
Flag of United States of America image

ASKER

I do not know where to start.  I have no code.
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Break down the task into parts, starting with

a. obtain all length 2 substrings from the source string by iteration [and print them out]

(the part in brackets can be removed later)
Avatar of for_yan
for_yan
Flag of United States of America image



Is this your class assignment ?
ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of for_yan
for_yan
Flag of United States of America image

write the code in this sense - post it we will correct
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

>>write the code

No need - you did it for him. Homework done then...
Java
Java

Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

102K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo