{"id":16483618,"url":"https://github.com/shpota/rainy-hills","last_synced_at":"2026-05-14T04:33:42.010Z","repository":{"id":78769808,"uuid":"112071097","full_name":"Shpota/rainy-hills","owner":"Shpota","description":"Rainy Hills problem solver implemented in Java with Wildfly Swarm","archived":false,"fork":false,"pushed_at":"2017-11-27T12:46:07.000Z","size":20,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-22T23:29:39.768Z","etag":null,"topics":["algorithm","complexity","interview","interview-practice","interview-project","interview-questions","interview-test","java-ee","memory-complexity","rainy-hills","wildfly","wildfly-swarm"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shpota.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-26T09:39:17.000Z","updated_at":"2023-05-12T16:49:25.000Z","dependencies_parsed_at":"2023-03-01T09:16:08.392Z","dependency_job_id":null,"html_url":"https://github.com/Shpota/rainy-hills","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shpota%2Frainy-hills","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shpota%2Frainy-hills/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shpota%2Frainy-hills/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shpota%2Frainy-hills/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shpota","download_url":"https://codeload.github.com/Shpota/rainy-hills/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241215484,"owners_count":19928491,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","complexity","interview","interview-practice","interview-project","interview-questions","interview-test","java-ee","memory-complexity","rainy-hills","wildfly","wildfly-swarm"],"created_at":"2024-10-11T13:14:32.757Z","updated_at":"2026-05-14T04:33:36.990Z","avatar_url":"https://github.com/Shpota.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rainy Hills\nRainy Hills problem solver. The application takes an integer array as an \ninput, and calculates the volume of water which remained after the rain, \nin units.\n\n### System requirements\n* JDK 8;\n* Maven 3.5;\n* The `8080` port must not be occupied.\n\n*Note: the app was tested with JDK 1.8.0_144 and Maven 3.5.2.*\n\n### Build \u0026 deploy\nPerform the next command to build the the project:\n\n    mvn clean package\nStart the project via:\n\n    java -jar target/rainy-hills-swarm.jar\nAccess the app in browser using \n[http://localhost:8080/](http://localhost:8080/) . \n\nAlternatively the app could be built and started by single command:\n\n    mvn clean wildfly-swarm:run\n\n### Application structure\nThe application is split into frontend part writen with `html/js/css` and \nbackend part writen with `Java 8` + `Wildfly Swarm`. The frontend accesses \nthe backend  via REST API calls.\n\nThe backend part is logically split into service level and REST API level.\nThe service part is represented by \n[SolvingService](./src/main/java/com/shpota/rainyhills/service/SolvingService.java).\nThe REST part is represented by \n[SolvingEndpoint](./src/main/java/com/shpota/rainyhills/rest/SolvingEndpoint.java).\nThe endpoint and the service are connected via CDI injection.\n\n### Test coverage\nThe application code is covered with unit and integration tests. Units tests are \nimplemented with `JUnit` and `Mockito`. Integration tests are based on `Arquillian`.\nIntegration tests are implemented in a [separate submodule](./src/it). They are not \nperformed during build process, and should be started separately via:\n\n    mvn integration-test\n\n### Algorithm complexity\nThe algorithm has *O(n)* time complexity because it passes the input array \n3 times performing constant number of operations during each pass.\nMemory complexity is also *O(n)* because the algorithm operates with 3 arrays\nand acquires memory only constant number of times during bypass.\n\n###### Improvements\nIt is not possible to decrease the time/memory complexity of the algorithm. \nThe optimal solution will still have *O(n)* time and memory complexity. However \nthere is still area of improvements. For instance it is possible to calculate\nthe end value during second pass of the array (once we calculate both right \ntop and left top values we can already accumulate the difference). But I left \nthe implementation the way it is because it holds good balance between \ncomplexity and code readability.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshpota%2Frainy-hills","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshpota%2Frainy-hills","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshpota%2Frainy-hills/lists"}