We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Because, if we need to waste operations to reach k operations, we can only do so in groups of 2 by doing an append and a delete. That line of code makes sure the number of operations we "waste" is divisible by 2.
Append and Delete
You are viewing a single comment's thread. Return to all comments →
Because, if we need to waste operations to reach k operations, we can only do so in groups of 2 by doing an append and a delete. That line of code makes sure the number of operations we "waste" is divisible by 2.
HackerRank solutions.