Question: In JAVA please write the following methods: Look for patterns like zip and zap in the string -- length-3, starting with 'z' and ending with

In JAVA please write the following methods:

Look for patterns like "zip" and "zap" in the string -- length-3, starting with 'z' and ending with 'p'. Return a string where for all such words, the middle letter is gone, so "zipXzap" yields "zpXzp". zipZap("zipXzap") "zpXzp" zipZap("zopzop") "zpzp" zipZap("zzzopzop") "zzzpzp"

Given a non-empty array, return true if there is a place to split the array so that the sum of the numbers on one side is equal to the sum of the numbers on the other side. canBalance([1, 1, 1, 2, 1]) true canBalance([2, 1, 1, 2, 1]) false canBalance([10, 10]) true

Return a version of the given string, where for every star (*) in the string the star and the chars immediately to its left and right are gone. So "ab*cd" yields "ad" and "ab**cd" also yields "ad". starOut("ab*cd") "ad" starOut("ab**cd") "ad" starOut("sm*eilly") "silly"

Return a version of the given array where all the 10's have been removed. The remaining elements should shift left towards the start of the array as needed, and the empty spaces a the end of the array should be 0. So {1, 10, 10, 2} yields {1, 2, 0, 0}. You may modify and return the given array or make a new array. withoutTen([1, 10, 10, 2]) [1, 2, 0, 0] withoutTen([10, 2, 10]) [2, 0, 0] withoutTen([1, 99, 10]) [1, 99, 0]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!