4. Final - CodingBat

Period 4 final programming question.

noTrees. Return a version of the given array where every occurrence of the word “tree” has been removed. Shift everything else down and place “grass” at the end of the array.

Examples:

noTrees(["rock", "tree", "Grass", "rock"])
==> ["rock", "Grass", "rock", "grass"]

noTrees(["Tree", "bush", "plant", "house", "TREE"])
==> ["bush", "plant", "house", "grass", "grass"]
  • You may make a new array or modify the existing one.
  • Match “tree” in any combination of cases of the letters.
  • Starter code: noTrees.
Last modified August 18, 2023: 2022-2023 End State (7352e87)