Standard Chartered Bank
Quick Navigation
July 6, 2025 • 4 reads
Summary
This post details the HackerRank Online Assessment for the Standard Chartered GBS Technology Apprenticeship, presenting two distinct algorithmic problems.
Full Experience
Company: Standard Chartered Bank
Role: Technology Apprenticeship
1. Suspicious Activity From Logs
Application logs provide valuable insights into user interactions and can help detect suspicious activities. You are given a log file represented as a string array, where each entry records a money transfer in the following format:"sender_user_id recipient_user_id amount". Each entry consists of:
- sender_user_id. The user initiating the transfer.
- recipient_user_id. The user receiving the transfer.
- amount. The transferred amount.
Write a function that identifies suspicious users - users who appear in at least threshold number of log entries, whether as a sender or a recipient. Return an array of user IDs that meet the threshold condition, sorted in ascending numerical order.
Example
logs = ["88 99 200", "88 99 300", "99 32 100", " 12 12 15"]
threshold = 2
The transactions count for each user, regardless of role, are:
ID | Transactions
99 | 3
88 | 2
12 | 1
32 | 1
There are two users with at least threshold = 2 transactions: 99 and 88. The returned array is ["88", "99"] in ascending order.
Note: In the last log entry, user 12 was on both sides of the transaction. This counts as only 1 transaction for user 12.
Function Description
Complete the function processLogs in the editor with the following parameter(s):
- string logs[n], each logs[i] denotes the ith entry in the logs.
- int threshold the minimum number of transactions in which a user must be involved (as either sender or recipient) to be included in the result.
Returns
string[]: A sorted array of user IDs that appear in at least the threshold number of transactions.
Constraints
- 1 <= n <= 10^5
- 1 <= threshold <= n
- The sender_user_id, recipient_user_id, and amount contain only characters in the range ascii['0'-'9'].
- The sender_user_id, recipient_user_id, and amount start with a non-zero digit.
- 0 < length of sender_user_id, recipient_user_id, amount <= 9.
- The result will contain at least one element.
Input Format for Custom Testing
Sample Case 0
Sample Input
STDIN | Function
4 → logs[] size n = 4
1 2 50 → logs = ["1 2 50", "1 7 70", "1 3 20", "2 2 17"]
1 7 70
1 3 20
2 2 17
2 → threshold = 2
Sample Output
1
2
Explanation
ID | Transactions
1 | 3
2 | 2
7 | 1
3 | 1
Only users 1 and 2 have at least threshold = 2 transactions. The returned array in numerically ascending order is ["1", "2"]. Note that in the last log entry, the user with ID 2 performed both roles in the transaction, which is counted as one transaction for the user.
Sample Case 1
Sample Input
STDIN | Function
4 → logs[] size n = 4
9 7 50 → logs = ["9 7 50", "22 7 20", "33 7 50", "22 7 30"]
22 7 20
33 7 50
22 7 30
3 → threshold = 3
Sample Output
7
Explanation
ID | Transactions
9 | 1
7 | 4
22 | 2
33 | 1
Only user 7 has 3 or more transactions. The returned array is ["7"].
2. Math Homework
Students have been given a series of math problems, each with a specific point value. Given a sorted array of these point values, determine the minimum number of problems a student needs to solve based on the following rules:- The student must always solve the first problem (at index i = 0).
- After solving the ith problem, the student can either solve the next problem (i+1) or skip ahead to the (i+2) problem.
- The student must continue solving problems until the difference between the maximum and minimum points of the solved problems meets or exceeds a given threshold.
- If the threshold cannot be met or exceeded, the student must solve all the problems.
Return the minimum number of problems the student needs to solve.
Example
threshold = 4
points = [1, 2, 3, 5, 8]

If a student solves points[0] = 1, points[2] = 3, and points[3] = 5, then the difference between the minimum and the maximum points solved is 5-1 = 4. This meets the threshold, so the student must solve at least 3 problems, so return 3.
If instead the threshold is 7, solve problems 0, 2, and 4, where points[4] - points[0] = 8-1 = 7. Again, the student must solve 3 problems.
There is no way to meet a threshold greater than 7. In that case, all problems need to be solved, and the return value is 5.
Function Description
Complete the function minNum in the editor with the following parameters:
- int threshold: the minimum difference required
- int points[n]: a sorted array of integers
Returns
int: the minimum number of problems that must be solved
Constraints
- 1 <= n <= 100
- 1 <= points[i] <= 1000
- 1 <= threshold ≤ 1000
Sample Case 0
Sample Input For Custom Testing
STDIN | Function
2 → threshold = 2
3 → points[] size n = 3
1 → points = [1, 2, 3]
2
3
Sample Output
2
Explanation
- The student chooses points[0] = 1 and points[2] = 3.
- The difference between the minimum and the maximum points is 3-1 = 2.
- This meets the threshold, and the return value is 2.

Sample Case 1
Sample Input For Custom Testing
STDIN | Function
4 → threshold = 4
5 → points[] size n = 5
1 → points = [1, 2, 3, 4, 5]
2
3
4
5
Sample Output
3
Explanation
- The student should choose points[0] = 1, points[2] = 3 and points[4] = 5.
- The difference between the minimum and the maximum points solved is 5-1 = 4.
- This meets the threshold and the return value is 3.

Feel free to try it out!
Interview Questions (2)
Q1
Suspicious Activity From Logs
Data Structures & Algorithms
Application logs provide valuable insights into user interactions and can help detect suspicious activities. You are given a log file represented as a string array, where each entry records a money transfer in the following format:
"sender_user_id recipient_user_id amount". Each entry consists of:
- sender_user_id. The user initiating the transfer.
- recipient_user_id. The user receiving the transfer.
- amount. The transferred amount.
Write a function that identifies suspicious users - users who appear in at least threshold number of log entries, whether as a sender or a recipient. Return an array of user IDs that meet the threshold condition, sorted in ascending numerical order.
Example
logs = ["88 99 200", "88 99 300", "99 32 100", " 12 12 15"]
threshold = 2
The transactions count for each user, regardless of role, are:
ID | Transactions
99 | 3
88 | 2
12 | 1
32 | 1
There are two users with at least threshold = 2 transactions: 99 and 88. The returned array is ["88", "99"] in ascending order.
Note: In the last log entry, user 12 was on both sides of the transaction. This counts as only 1 transaction for user 12.
Function Description
Complete the function processLogs in the editor with the following parameter(s):
- string logs[n], each logs[i] denotes the ith entry in the logs.
- int threshold the minimum number of transactions in which a user must be involved (as either sender or recipient) to be included in the result.
Returns
string[]: A sorted array of user IDs that appear in at least the threshold number of transactions.
Constraints
- 1 <= n <= 10^5
- 1 <= threshold <= n
- The sender_user_id, recipient_user_id, and amount contain only characters in the range ascii['0'-'9'].
- The sender_user_id, recipient_user_id, and amount start with a non-zero digit.
- 0 < length of sender_user_id, recipient_user_id, amount <= 9.
- The result will contain at least one element.
Input Format for Custom Testing
Sample Case 0
Sample Input
STDIN | Function
4 → logs[] size n = 4
1 2 50 → logs = ["1 2 50", "1 7 70", "1 3 20", "2 2 17"]
1 7 70
1 3 20
2 2 17
2 → threshold = 2
Sample Output
1
2
Explanation
ID | Transactions
1 | 3
2 | 2
7 | 1
3 | 1
Only users 1 and 2 have at least threshold = 2 transactions. The returned array in numerically ascending order is ["1", "2"]. Note that in the last log entry, the user with ID 2 performed both roles in the transaction, which is counted as one transaction for the user.
Sample Case 1
Sample Input
STDIN | Function
4 → logs[] size n = 4
9 7 50 → logs = ["9 7 50", "22 7 20", "33 7 50", "22 7 30"]
22 7 20
33 7 50
22 7 30
3 → threshold = 3
Sample Output
7
Explanation
ID | Transactions
9 | 1
7 | 4
22 | 2
33 | 1
Only user 7 has 3 or more transactions. The returned array is ["7"].
Q2
Math Homework
Data Structures & Algorithms
Students have been given a series of math problems, each with a specific point value. Given a sorted array of these point values, determine the minimum number of problems a student needs to solve based on the following rules:
- The student must always solve the first problem (at index i = 0).
- After solving the ith problem, the student can either solve the next problem (i+1) or skip ahead to the (i+2) problem.
- The student must continue solving problems until the difference between the maximum and minimum points of the solved problems meets or exceeds a given threshold.
- If the threshold cannot be met or exceeded, the student must solve all the problems.
Return the minimum number of problems the student needs to solve.
Example
threshold = 4
points = [1, 2, 3, 5, 8]

If a student solves points[0] = 1, points[2] = 3, and points[3] = 5, then the difference between the minimum and the maximum points solved is 5-1 = 4. This meets the threshold, so the student must solve at least 3 problems, so return 3.
If instead the threshold is 7, solve problems 0, 2, and 4, where points[4] - points[0] = 8-1 = 7. Again, the student must solve 3 problems.
There is no way to meet a threshold greater than 7. In that case, all problems need to be solved, and the return value is 5.
Function Description
Complete the function minNum in the editor with the following parameters:
- int threshold: the minimum difference required
- int points[n]: a sorted array of integers
Returns
int: the minimum number of problems that must be solved
Constraints
- 1 <= n <= 100
- 1 <= points[i] <= 1000
- 1 <= threshold ≤ 1000
Sample Case 0
Sample Input For Custom Testing
STDIN | Function
2 → threshold = 2
3 → points[] size n = 3
1 → points = [1, 2, 3]
2
3
Sample Output
2
Explanation
- The student chooses points[0] = 1 and points[2] = 3.
- The difference between the minimum and the maximum points is 3-1 = 2.
- This meets the threshold, and the return value is 2.

Sample Case 1
Sample Input For Custom Testing
STDIN | Function
4 → threshold = 4
5 → points[] size n = 5
1 → points = [1, 2, 3, 4, 5]
2
3
4
5
Sample Output
3
Explanation
- The student should choose points[0] = 1, points[2] = 3 and points[4] = 5.
- The difference between the minimum and the maximum points solved is 5-1 = 4.
- This meets the threshold and the return value is 3.

Feel free to try it out!