Practice Incremental Memory Leak
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given two integers memory1 and memory2 representing the available memory in bits on two memory sticks. There is currently a faulty program running that consumes an increasing amount of memory every second. At the ith second (starting from 1), i bits of memory are allocated to the stick with more available memory (or from the first memory stick if both have the same available memory). If neither stick has at least i bits of available memory, the program crashes. Return an array containing [crashTime, memory1crash, memory2crash], where crashTime is the time (in seconds) when the program crashed and memory1crash and memory2crash are the available bits of memory in the first and second sticks respectively.
Source: Incremental Memory Leak on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
memory1 = 2, memory2 = 2
[3,1,0]
# Example 2
memory1 = 8, memory2 = 11
[6,0,4]
Constraints
Related LeetCode Problems
Practice more problems similar to Incremental Memory Leak.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.