Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nahrens007/rts-challenge
Code for RTS Labs challenge.
https://github.com/nahrens007/rts-challenge
Last synced: about 2 months ago
JSON representation
Code for RTS Labs challenge.
- Host: GitHub
- URL: https://github.com/nahrens007/rts-challenge
- Owner: nahrens007
- Created: 2021-11-16T18:57:17.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-17T15:30:45.000Z (about 3 years ago)
- Last Synced: 2024-10-13T00:57:06.856Z (3 months ago)
- Language: Java
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rts-challenge
Please write a class in the language of your choice that contains the following two public methods:- aboveBelow accepts two arguments
- An unsorted collection of integers (the list)
- An integer (the comparison value)
- Returns a hash/object/map/etc. with the keys "above" and "below" with the corresponding count of integers from the list that are above or below the comparison value
```
Example usage:
input: [1, 5, 2, 1, 10], 6
output: { "above": 1, "below": 4 }
```- stringRotation accepts two arguments
- A string (the original string)
- A positive integer (the rotation amount)
- Returns a new string, rotating the characters in the original string to the right by the rotation amount and have the overflow appear at the beginning
```
Example usage:
input: "MyString", 2
output: "ngMyStri"
```# Solution
Provides a class with 2 functions.
- aboveBelow(int[], int) : HashMap
- Returns a HashMap with keys for "above","below","equal", with the Integer value of the key being the count of times an integer from the int[] occurs that is less than, greater than, or equal to the int argument.
- Example: aboveBelow(new int[] {1,5,2,1,20,24,10,66,6,6,6,6,6,6}, 6) = {equal=6, below=4, above=4}
- stringRotation(String, int) : String
- Returns a string with it's characters rotated by the amount specified by the int argument.
- Example: stringRotation("MyString",2) = "ngMyStri"