Complete the function (scramble str1 str2) that returns true if a portion of str1 characters can be rearranged to match str2, otherwise returns false.
Only lower case letters will be used (a-z). No punctuation or digits will be included. Performance needs to be considered
(scramble? “rekqodlw” ”world') ==> true
(scramble? “cedewaraaossoqqyt” ”codewars”) ==> true
(scramble? “katas” “steak”) ==> false
Create a web service that accepts two strings in a request and applies function scramble? from previous task to them.
Create a UI in ClojureScript with two inputs for strings and a scramble button. When the button is fired it should call the API from previous task and display a result.
Please pay attention to tests, code readability and error cases.
You will need Leiningen 2.0 or above installed.
To start a web server for the application, run in separate terminals:
lein run
lein figwheel
To run tests, execute:
lein test
To compile for production:
lein uberjar
The resulting jar can be found in the target/uberjar folder. It can be run as follows:
java -jar scrambler.jar
Running application will be available at http://localhost:3000/ on your machine.