Questions tagged [anagram]

A word, phrase, or name formed by rearranging the letters of another, such as cinema, formed from iceman.

470 questions
48
votes
36 answers

How to check if two words are anagrams

I have a program that shows you whether two words are anagrams of one another. There are a few examples that will not work properly and I would appreciate any help, although if it were not advanced that would be great, as I am a 1st year programmer.…
Chilli
  • 583
  • 1
  • 5
  • 8
47
votes
13 answers

Finding anagrams for a given word

Two words are anagrams if one of them has exactly same characters as that of the another word. Example : Anagram & Nagaram are anagrams (case-insensitive). Now there are many questions similar to this . A couple of approaches to find whether two…
h4ck3d
  • 5,584
  • 15
  • 44
  • 73
29
votes
7 answers

Optimizing very often used anagram function

I have written a function that determines whether two words are anagrams. Word A is an anagram of word B if you can build word B out of A just by rearranging the letters, e.g.: lead is anagram of deal This is my function: bool…
mel-
  • 533
  • 4
  • 11
25
votes
23 answers

Using Python, find anagrams for a list of words

If I have a list of strings for example: ["car", "tree", "boy", "girl", "arc"...] What should I do in order to find anagrams in that list? For example (car, arc). I tried using for loop for each string and I used if in order to ignore strings in…
user1040563
  • 4,295
  • 8
  • 29
  • 35
21
votes
29 answers

Anagrams finder in javascript

I am supposed to write a program in JavaScript to find all the anagrams within a series of words provided. e.g.: monk, konm, nkom, bbc, cbb, dell, ledl, llde The output should be categorised into rows: 1. monk konm, nkom; 2. bbc cbb; 3. dell ledl,…
jiaoziren
  • 1,209
  • 3
  • 13
  • 15
19
votes
14 answers

Algorithm for grouping anagram words

Given a set of words, we need to find the anagram words and display each category alone using the best algorithm. input: man car kile arc none like output: man car arc kile like none The best solution I am developing now is based on an hashtable,…
Ahmed Said
  • 6,813
  • 10
  • 52
  • 92
16
votes
7 answers

Ruby anagram solver

I am wanting to write a anagram type solver in Ruby but it will work against a list of words, like so. List of words is: the these one owner I would allow the user to input some letters, e.g noe, and it would search the word list for words that it…
RailsSon
  • 17,439
  • 31
  • 80
  • 104
16
votes
8 answers

Code golf: find all anagrams

A word is an anagram if the letters in that word can be re-arranged to form a different word. Task: The shortest source code by character count to find all sets of anagrams given a word list. Spaces and new lines should be counted as…
Charles Ma
  • 41,485
  • 21
  • 80
  • 98
13
votes
1 answer

How to use the 'in' operator in guard clauses?

I am trying to write an anagram checker in Elixir. It takes 2 words, the first one is a reference, the second is to be tested as a possible anagram of the first. I am trying to write it with recursion and pattern matching. I get an error about using…
svarlet
  • 565
  • 5
  • 13
12
votes
8 answers

Algorithm to get a list of all words that are anagrams of all substrings (scrabble)?

Eg if input string is helloworld I want the output to be like: do he we low hell hold roll well word hello lower world ... all the way up to the longest word that is an anagram of a substring of helloworld. Like in Scrabble for example. The input…
PowerApp101
  • 1,778
  • 1
  • 16
  • 25
11
votes
1 answer

Why am i getting " Duplicate modifier for the type Test" and how to fix it

I was trying to make a method that returns true if given "Strings" are anagrams. unfortunately i cant even test it and i don know what is wrong. The markers at left says: Multiple markers at this line - Breakpoint:Test - Duplicate…
EvilDumplings
  • 191
  • 1
  • 2
  • 8
11
votes
23 answers

Checking strings against each other (Anagrams)

The assignment is to write a program that accepts two groups of words from the user and then prints a "True" statement if the two are anagrams (or at least if all the letters of one are present in the other) and a "False" statement if not. Being…
Kyle
  • 121
  • 1
  • 1
  • 5
10
votes
2 answers

Java 8 Stream function to group a List of anagrams into a Map of Lists

Java 8 is about to be released... While learning about Streams, I got into a scenario about grouping anagrams using one of the new ways. The problem I'm facing is that I can't find a way to group Strings objects using the map/reduce functions.…
Marcello de Sales
  • 17,280
  • 12
  • 60
  • 72
10
votes
6 answers

Algorithm to remove a character from a word such that the reduced word is still a word in dictionary

Here is the scenario, Given a word remove a single character from a word in every step such that the reduced word is still a word in dictionary. Continue till no characters are left. Here is the catch: You need to remove the right character, for eg.…
nmd
  • 755
  • 1
  • 6
  • 16
9
votes
35 answers

Anagram algorithm in java

I would like to make anagram algorithm but This code doesn't work. Where is my fault ? For example des and sed is anagram but output is not anagram Meanwhile I have to use string method. not array. :) public static boolean isAnagram(String s1 ,…
SemihY
  • 229
  • 1
  • 3
  • 11
1
2 3
31 32