Implemented coding exercises in ruby alongwith testcases using minitest.
Provided two solutions. First one with using array manipulations. Second one with using hash. Results from benchmark-ips shows that the solution with hash was more time efficient, but it involves the usage of hash(extra space). On the other side, array manipulations solution involves the shortlisting of positive elements + sorting + uniq and it involves more time consumption.
- Ruby v-2.6.0
- Minitest
- Benchmark-ips
Test cases are written using minitest
Anyone who want to run it locally can use following process:
- Extract the zip file.
- Go to the
tests
directory i.ecd DigsiteChallenge/tests
- To run all the test cases use this:
bash driver.sh
- For running individual test cases for coding exercises, use this:
ruby code1_test.rb