Code Monkey home page Code Monkey logo

wordjumblesolver's Introduction

Word Jumble Solver

Word Jumble Solver is a small program written in Java which solves word jumble problem.

This program is developed for coding challenge from Twice

Description

  • WordJumbleSolver uses a quick lookup dictionary using the words file generally found at /usr/share/dict/words on un*x type operating systems.
  • If running on non-un*x based operating system the user must provide a file containing words delimited by newline like this which will be used as valid dictionary words.
  • WordJumbleSolver then build a dictionary from this file where each word is hashed with the product of prime number associated to its characters. Since, products of primes are unique this gurantees that all the word which fall under the same key will be anagrams
  • WordJumbleSolver solves the jumble word by generating all possible combination of the jumbled word and finding its anagrams from the dictionary.
  • Here is an example

jumbled word : ogd

Word Jumble Solver: Here are the valid words -

og go god dog od do

File Structure

Filename Description
App.java The main Word Jumble Solver class
AlphabetToPrimeMap.java Stores alphabet to prime number mapping and calculates prime factors for words
Combinatorics.java Combinatorics class which generates all possible combination of string
Dictionary.java The dictionary class which stores all the dictionary words which are anagrams to each other in a hash where the key is product of their character's prime number
OSType.java The class which helps to determines the type of operating system. Code adopted from here

##Dependencies This project depends on the following:

  1. Maven
  2. A newline dependent words file on non-un*x operating system.

##How to use Clone the repository on you local machine and from the command line excute to following command from the parent directory

r******@R*****-MacBook-Pro> mvn package

r******@R*****-MacBook-Pro> java -cp target/WordJumbleSolver-1.0-BETA.jar com.rohitsinha.wordjumble.App ogd

On non Un*ix operating system you must provide the path to the words file (a newline delimited file containing all the words). In this case the command will be

java -cp target/WordJumbleSolver-1.0-BETA.jar com.rohitsinha.wordjumble.App filepath ogd

Testing

The program has been tested on following operating systems:

  1. Mac OSX 10.9.2
  2. Ubuntu 13.10

##Version 1.0 beta

##Contact Information Please report any bugs or issues to: [email protected]

##License MIT License

wordjumblesolver's People

Contributors

rohitsinha54 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.