1. Compression
To reduce the size of messages transmitted over the internet, a compression algorithm encodes consecutive repeating characters in a string.
Your task is to compress the given string using this rule:
- Scan the string from left to right and group consecutive identical characters.
- If a character appears once, add just the character to the output.
- If a character appears more than once in a row, add the character followed by the number of consecutive occurrences.
Example
Suppose message = "aabbccca".
Output: "a2b2c3a"
Constraints
- All characters in message are in the range ascii[a-z].
- length of message ≤ 10^5
2. Java Banking: Transaction Search Bugfix
The Java banking base repository includes core functionality for:
- Account creation and management
- Transaction management
- User model and authentication
Currently, there are some issues with the existing functionality for searching transactions by their reference ID that need to be addressed to ensure users can properly track and retrieve their transaction records.
Task
Fix the bugs so that the API works correctly and allows users to search for transactions using their unique reference ID.
The APIs should:
- Find a transaction using its unique reference ID
- Return complete transaction details
- Enforce authorization so users can only view transactions they are part of (sender or receiver)
Curl Scripts:
To make API testing easier, this repository includes helper curl scripts under the curl_scripts/ directory. These scripts handle authentication, user creation, account setup, transactions, and testing the balance snapshot endpoint.
Notes Before Running Scripts:
- When you start the Spring Boot server, it will occupy the current terminal session.
- To run the curl scripts, you must open a new terminal tab and navigate to the
curl_scriptsfolder - All required arguments and parameters are already configured in
arguments.json. You do not need to pass any command-line arguments. - Simply execute the scripts directly, for example
./02register_user.sh- Registers a new user with random credentials./03login.sh- Login with the same user./05create_account.sh- Account creation
- See
curl_scripts/HELPER.mdfor more detailed usage instructions on other scripts.
我们也有代面试,面试辅助,OA代写等服务助您早日上岸~

