Git Product home page Git Product logo

mupetmower / labelinsightbecodetest Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 51 KB

Solves two problems. 1- Find all English alphabetic chars not in input. 2- Given a list of "particles" that move right(R) or left(L) at given speed, iterate through and "animate" the particles' movement (particles can pass through each other, 2 can hold one position). Input example(speed, init) 2 "..RLRL..LLRR.RL.LRRL.". Benchmark class included.

Java 100.00%

labelinsightbecodetest's Introduction

Label Insight - Backend Code Test

Prerequisits

  • Java 1.8+
  • Make sure your Java Home is 1.8, or your IDE uses 1.8 to compile and run this project, or that you use Java 8 to build this as a jar and run with using javac, etc.

How to Run

This can run from either an IDE or built and then ran from the command line.

If running from an IDE (IntelliJ/Eclipse):

  • Open Project in IDE
  • Setup the project to use Java 1.8
  • Use the IDE to run Main, located at src/com/lableinsight/codetest
  • You will be prometed to enter the method (getMissingLetters or animate)
    • Please do not use quotes
  • Another prompt will show for input or speed and then input
    • Please make sure speed is an integer and do not use quotes for either parameter

If Building and Running from cmd or a terminal:

  • Use desired IDE or java to compile and build the project with Java 1.8+ and build a jar artifact
  • Make sure you use Java 1.8 to run in cmd/terminal or that Java Home is set to your jdk1.8+ location
  • To run use java -jar <location of jar file> <methodName> <param1> <param2>
    • <methodName> is getMissingLetters or animate, no quotes, <param2> is not used if you are running the getMissingLetters method.
    • If running getMissingLetters, <param1> will be the input String surrounded with quotes. Example: java -jar LabelInsightBECodeTest.jar getMissingLetters "I am a kitty cat"
    • If running animate, <param1> will be the speed as an integer, no quotes, while <param2> will be the init String surrounded by quotes. Example: java -jar LabelInsightBECodeTest.jar animate 2 "..LRRL..RLRL.."

Notes

I also created a benchmark class which uses Java reflection to invoke the given method from given class and run it while tracking the time in nanoseconds that it took to execute.
It will also run this a given number of times and average the nanoseconds that the method took per each run and will output the result.

I used this class to run benchmark tests on my methods and tweak them to gain faster execution speed. However, I did not have enough time to enable a user to use this as an option when running, but left it in the source and it can be played with if desired.

I also have this project on GitHub and was working on more implementations, using different techniques (some working, some not quite yet) and left those in a branch called feature/other-impl-wip. These different implementations were ment to serve as different approaches to the same problem. Then I woulod be able to benchmark them with small/large inputs and running/many/few times to se which performed better under certain circumstances.

These were taken out of the project to clean things up, but note that the Particle class and the ParticleFrame class both are part of these and remain in the source code.

The github page can be found at https://github.com/mupetmower/LabelInsightBECodeTest if interested (or to view the readme with formatting).

Thank You!

labelinsightbecodetest's People

Contributors

mupetmower 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.