Anagrams 2


Collapse Content

Semi-anagrams are anagrams where you drop some letters in one word and then re-arrange the remaining letters to get the other word. This means all the letters of one word can be found in the other word, but not necessarily vice versa.

Given two words, determine if they are semi-anagrams. For example, all the letters of "pool" can be found in "looped" so they are semi-anagrams.

Challenge

Create a program that prints true if the given words are semi-anagrams of each other and false otherwise.

Please sign in or sign up to submit answers.

Alternatively, you can try out Learneroo before signing up.

Comments

  • Please, a little more help?

  • Please can i just get the awnser even on stack they cant seem to figure it out?

  • It's a little easier to solve this challenge if you used the "counting solution" for the last problem. If you sorted, you can adjust your algorithm to go through the letters comparing them...

  • Check my solution please. it is the right solution. In Eclips al the ouput is like it should be, but here it gives two errors?

    carthorse orchestra: should give true in eclips it does!!

    Here when i run my code it gives false. i had this problem earlier , but the code is really correct?

  • Be careful when using Java's containsAll since it doesn't check the number of times an item appears.

  • I know, thats why i have the third list. I compare it to a third list. please check this.
    It works on eclipse for me in all examples. i use a third list and check the containsAll but also the length.. So that is not the problem.

  • Turns out it's a difference between Java 7 (running on this site) and Java 8. See StackOverflow for more details.

Contact Us
Sign in or email us at [email protected]