What do you mean by in-place algorithm ?


  • 1
    D

    I am asking this because I am trying to use stack for my solution. Is it considered in-place ?


  • 2
    S

    In-place usually means 'transforming the original input using only constant extra memory'. In this context, you should reuse the original nodes rather than creating new nodes, and use only O(1) auxiliary memory. If your algorithm must use a stack, then it is not an in-place algorithm.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.