Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7557579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:10:06+00:00 2026-05-30T12:10:06+00:00

I am not good at Java so I just would like to say in

  • 0

I am not good at Java so I just would like to say in advance “THIS IS MY HOMEWORK” and please “DO NOT DO MY HOMEWORK”, this is the very first homework on recursion so this is my first time. Having said that, these are the instructions of my homework but I am not sure the steps that I need to take in order to achieve the goal. All I need is a great guy/girl who can give me good details on how to finish my homework, kind of steps. I have read the book, checked some websites about recursion, but I feel that I need a little more help.

Write a recursive static method that, given two string s and t,
returns an array of all positions where t occurs in s. For example,
findLocations(“Frances ran and ran”, “ran”) returns [1, 8, 16].

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:10:07+00:00Added an answer on May 30, 2026 at 12:10 pm

    I would probably approach it like this:

    1. Given the argumets inputString and substring, call index = inputString.indexOf(substring).

    2. If the substring is not found (index = -1), you should return the empty array (new int[0]), since no occurrences of the substring exists in the inputString.

    3. Otherwise the substring does exist, in which case you should do the following:

      1. Get the array of indexes for the remaining part of the string, using something like arr = findLocations(inputString.substring(index+1), substring)

      2. Adjust the indexes in arr by adding index to each element.

      3. return index, concatenated with arr.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a good OLEDate java implementation, and this one does not seem to
I would like to find a good (up-to-date) Java Trail type beginning tutorial on
I have heard that the Java implementation of Generics is not as good as
I'm not good with JavaScript, and this is Google's code. I'm getting a object
It seems not good for me, reporting errors like 'General Error: '+...., Is there
Honestly I'm very bad at CSS and not good at dealing with color /
Pretty straightforward stuff, here -- I'm just not good enough with mysql to understand
lets say I have a String like this [{ name : Ronald , firstname
I would like to do some stuff in Java that would be clearer if
Im using java/mongodb. I would like to create a table (collection) with some users.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.