1

I have a JSON array with all the four letter words from which I pick a random word and present to the user in a jumbled form. But the problem is that sometimes there are more than one solution for the jumbled word.

For example: "tins","snit","nits" are three words with the same letters 't','i','n','s'.

How can I get the all the words that have the letters of the word that I picked in random from the JSON array?

enter image description here

A.L
  • 10,259
  • 10
  • 67
  • 98
pavitran
  • 814
  • 1
  • 10
  • 25
  • Possible duplicate of [Finding All Combinations of JavaScript array values](http://stackoverflow.com/questions/4331092/finding-all-combinations-of-javascript-array-values) This show how to use multiple arrays but this may work for you too. – A.L Jun 14 '16 at 14:14
  • 3
    Maybe this helps? http://stackoverflow.com/a/25913143/923441 Basically you sort the strings' characters alphabetically and then test if the strings are equal to each other – A. Steenbergen Jun 14 '16 at 14:16
  • Is the question *how to generate all the possible words* or *how to check that the word is valid*? – A.L Jun 14 '16 at 15:56
  • no it's about checking if other words in the array has same letter as the picked word.for example by random i pick a word "what" than it must check the array for words like "thaw" or "hawt". – pavitran Jun 14 '16 at 16:42
  • thank you @a-steenbergen ! the comment helped,wasn't exactly what i was looking for,but i figured out from there. – pavitran Jun 25 '16 at 19:22
  • I don't know if stackoverflow allows it but I eventually found the solution with the help of comments and made this android app. https://play.google.com/store/apps/details?id=me.brainiacs.wordplay (it was my first android app) – pavitran Feb 16 '17 at 09:06

0 Answers0