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.
Here is a less elegant solution in Python3 with the inputs handled in modern HackerRank. Originally, I had a for instead of a while loop, but a final i=m-1 could arise in two ways. Continuing Shikhar47's remark on efficiency, my code is at worst O(n) in time complexity.
Append and Delete
You are viewing a single comment's thread. Return to all comments →
Here is a less elegant solution in Python3 with the inputs handled in modern HackerRank. Originally, I had a
for
instead of awhile
loop, but a finali=m-1
could arise in two ways. ContinuingShikhar47
's remark on efficiency, my code is at worstO(n)
in time complexity.