alantanlc / misspelt-word

Given a dictionary of words and a misspelt input, write a function which will find 3 words from the dictionary which are closest (by difference of 1 character) to the given input.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

misspelt-word

Given a dictionary of words and a misspelt input, write a function which will find 3 words from the dictionary which are closest (by difference of 1-character) to the given input.

e.g. dict = {vil, sit, flick, pat, pluck, sat, vat}, input = vit, result = {sit, vil, vat }

https://www.careercup.com/question?id=5697729628471296

Assumptions

  1. Dictionary will contain 3 or more words of the same length as the given input
  2. Function can return any 3 words that fulfill the 1-character difference)
  3. Position of the 1-character difference does not matter (Character diff at position 1 of a word and character diff at position 2 of another word are equally "close" to the given input)

About

Given a dictionary of words and a misspelt input, write a function which will find 3 words from the dictionary which are closest (by difference of 1 character) to the given input.


Languages

Language:C++ 100.0%