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

 

jebbert@volusia.k12.fl.us strings > strFromStr
prev  |  next  |  chance

Given two strings, original and target, determine if it is possible to make the target string by selecting and possibly rearanging some or all of the characters present in the original string. For example, strFromStr("thanks alot","halt") returns true because "halt" can be created by selecting some of the letters from "thanks alot". Here is another example: strFromStr("what is for dinner","did he sue") returns false even though all the letters are present in the original string. The reason it returns false is that the original string only has one "d" and one "e" yet the target string has two of each. By the way, this IS case sensitive, so strFromStr("IGLOO HOUSE","hole") returns false, however strFromStr("IGLOO HOUSE","HOLE") returns true.


strFromStr("bart simpson says hi", "shirpa ban nay") → false
strFromStr("ancient voices", "nasca lines") → false
strFromStr("Santiago Chile", "Can it go") → false

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

public boolean strFromStr(String original, String target) { }

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: 420

Copyright Nick Parlante 2017 - privacy