id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

orion.a.smith@gmail.com apcsa-arrays > apcsaArraysThreeSequences
prev  |  next  |  chance

Given a String input str, create and return an array of Strings containing every three-character sequence from str, in the same order they appear in str. Overlapping sequences are acceptable. Precondition: str will have at least 3 characters.


HINT: How long your output array is going to be is related to the length of the input.  Remember that length is a method with Strings (uses parentheses), but a field with arrays.

apcsaArraysThreeSequences("Hello") → ["Hel", "ell", "llo"]
apcsaArraysThreeSequences("well hi there") → ["wel", "ell", "ll ", "l h", " hi", "hi ", "i t", " th", "the", "her", "ere"]
apcsaArraysThreeSequences("half") → ["hal", "alf"]

...Save, Compile, Run (ctrl-enter)

public String[] apcsaArraysThreeSequences(String str) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 230

Copyright Nick Parlante 2017 - privacy