Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gargnipungarg/mobile-text-mapper
https://github.com/gargnipungarg/mobile-text-mapper
Last synced: 27 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/gargnipungarg/mobile-text-mapper
- Owner: gargnipungarg
- Created: 2021-01-14T07:46:17.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-14T16:55:56.000Z (almost 4 years ago)
- Last Synced: 2023-08-20T15:37:28.735Z (over 1 year ago)
- Language: Java
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
## mobile-text-mapper
========================================================================================================================================================================
# Problem Statement
Please read all given below given instruction and consider all scenarios to get the best score*Write a program that takes a number and produces all possible phrases consisting of words that match
this number while using all digits and inserting spaces between words as needed.
Use a digit to char mapping printed on the telephone keyboards and a word list as a dictionary
(e.g. http://www.mieliestronk.com/corncob_lowercase.txt). Digit to char mapping is (like on the
standard phone):
2 => [ ‘a’, ‘b’, ‘c’ ]
3 => [ ‘d’, ‘e’, ‘f’ ]
...
9 => [ ‘w’, ‘x’, ‘y’, ‘z’ ]
For example, if input is “56835282” and dictionary contains words “love” and “java” and “lava”, the
output must contain strings “love java” and “love lava”.
Please provide a full solution. Please pay close attention to the performance. The code must work fast
and be scalable. Please test on a long number (for instance 20 digits) and measure time.
========================================================================================================================================================================
# SolutionSolution involves dynamic programming to reduce recursion calls and uses streams and filters to reduce the huge data strucutre that can be created with a string of length 20+.
========================================================================================================================================================================
# CommandsBuild:
mvn clean install
Test:
mvn test
Execute: Needs a runtime argument for which possible phrases need to be evaluated.
Example - java -jar target\mobile-text-mapper-0.0.1-SNAPSHOT.jar 56835282
Sample Output -
Dictionary Word Matches :
[lot, loud, love, lava, java, flat, jot]Phrases found :
loud java
love java
loud lava
love lava========================================================================================================================================================================
# Requirements
Java 8 and 9 have been used, so please use versions ahead of these. Created with Java 14 jdk.
========================================================================================================================================================================