Tip 1: Practice on coding platforms.
Tip 2: Write clean and optimized code.
Tip 1: Go through your resume.
Tip 2: Include a few points about the role requirements in your resume.
Design a system to schedule and return news articles based on their publish time.
Each article has an ID, title, and a scheduled publish timestamp.
Requirements:
Add articles with their scheduled time.
Retrieve all articles that should be published up to the current time.
Remove published articles.
Data Structures Used:
Min Heap: To maintain articles sorted by publish time
HashMap: To store article details for quick access
Then use functions to add articles, remove articles, and get articles.



If a string has 'x' repeated 5 times, replace this "xxxxx" with "x5".
The string is compressed only when the repeated character count is more than 1.
The consecutive count of every character in the input string is less than or equal to 9.
Start by checking if the string is empty. Initialize an empty result list and set the counter to 1 for the first character. Iterate through the string from the second character. If the current character matches the previous one, increment the counter. If it's different, add the previous character and its count (if count > 1) to the result list, then reset the counter to 1 for the new character. After the loop, add the final character and its count. Join the result list into a string. Compare lengths - return the compressed version if it's shorter, otherwise return the original string.


Input: [1,2,3,1]
Output: 4
Mr. X. can rob the first house and the third house, total money = 1 + 3.
Hence, the total money robbed by Mr. X. is 4.
Start by handling edge cases: return 0 if the array is empty, the first element if the length is 1, or the maximum of the first two elements if the length is 2. For the main logic, we use two variables (or a DP array) to track the maximum money possible at each position. At each house, we have two choices: either rob this house and add money from two houses back (prev2 + current_house), or skip this house and keep the previous house's money (prev1). Take the maximum of these choices. Move the window forward by updating prev2 and prev1. The final answer will be in prev1.
Tip 1: Use the STAR approach.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is the purpose of the return keyword?