Process Logs
Learn this problemProblem statement
Application logs are useful in analyzing interaction with an application and may also be used to detect suspicious activities.
A log file is provided as a string array where each entry represents a money transfer in the form "sender_user_id recipient_user_id amount". Each of the values is separated by a space.
- sender_user_id and recipient_user_id both consist only of digits, are at most 9 digits long and start with non-zero digit
- amount consists only of digits, is at most 9 digits long and starts with non-zero digit
Logs are given in no particular order. Write a function that returns an array of strings denoting user_id's of suspicious users who were involved in at least threshold number of log entries. The id's should be ordered ascending by numeric value.
Function
processLogs(logs: String[], threshold: int) → String[]
Complete the function processLogs in the editor.
The function has the following parameter(s):
- 1.
String logs[n]: each logs[i] denotes the ith entry in the logs - 2.
int threshold: the minimum number of transactions that a user must have to be included in the result
Returns
String[]: an array of user id's as strings, sorted ascending by numeric value
♫⋆。♪ ₊˚♬ ゚.Credit to Charlotte༊·˚
Examples
Example 1
logs = ["88 99 200", "88 99 300", "99 32 100", "12 12 15"]threshold = 2return = ["88", "99"]Constraints
More IBM problems
- Parent Process NumberOA · Seen Jul 2026
- Request Retry CountOA · Seen Jul 2026
- Count Strictly Increasing Subsequences of Length 3OA · Seen Jul 2026
- Maximum Requests in a Time WindowOA · Seen Jul 2026
- Query Type Frequency WindowOA · Seen Jul 2026
- Minimum Number of Non-Empty Disjoint SegmentsOA · Seen Jul 2026
- Spam Text ClassificationOA · Seen Jul 2026
- Count Ideal NumbersOA · Seen Jun 2026