CodeWorkout Practice 2

Score: 0 / 62.0


Exercises

0 / 1.0

Given a string of even length, return the first half. So the string "WooHoo" yields "Woo".

0 / 1.0

Write a function fullWords(s) that returns a string no longer than 20 characters. If the string s is longer than 20 characters, just...

0 / 1.0

Write a function first10(s) that returns the first 10 characters of s. If s is longer than 10 characters, just truncate it. If s is...

0 / 1.0

Given an array of integers, return the largest value in the array. Assume the array has only posivitive numbers. If the array is empty,...

0 / 1.0

Write a function untilSpace(s) that returns a substring of s starting at the beginning and extending until a space is found. The space is...

0 / 1.0

This methods takes a String object as a parameter and returns an encrypted version of the object. The encryption is done in two steps:...

0 / 1.0

This method takes a String object as a parameter and returns a compressed version of the object. The method compresses the String by...

0 / 1.0

Write a function in Java that implements the following logic: Given a string and an int n, return a string made of n repetitions of the...

0 / 1.0

Given a string, compute a new string by moving the first char to come after the next two chars, so "abc" yields "bca". Repeat this...

0 / 1.0

Given a string, count the number of words ending in 'y' or 'z'--so the 'y' in "heavy" and the 'z' in "fez" count, but not the 'y' in...

0 / 1.0

Given two strings, word and a separator sep, return a big string made of count occurrences of the word, separated by the separator...

0 / 1.0

Given a string, return the string made of its first two chars, so the string "Hello" yields "He". If the string is shorter than length 2,...

0 / 1.0

Given a string, return a new string made of 3 copies of the last 2 chars of the original string. The string's length will be at least 2.

...
0 / 1.0

Given a string str and an int n, return a string made of the first n characters of the string, followed by the first n - 1 characters of...