cp-library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub kobejean/cp-library

:warning: cp_library/ds/stack/stack_fn.py

Required by

Code

import cp_library.__header__
import cp_library.ds.__header__
import cp_library.ds.stack.__header__

class stack:
    __slots__ = 'd', 'n'
    def __init__(st, cap): st.d, st.n = [0]*cap, 0
    def push(st, x): st.d[st.n] = x; st.n += 1
    def pop(st): st.n -= 1; return st.d[st.n]
    def peek(st): return st.d[st.n-1]
    def __len__(st): return st.n
'''
╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸
             https://kobejean.github.io/cp-library               
'''



class stack:
    __slots__ = 'd', 'n'
    def __init__(st, cap): st.d, st.n = [0]*cap, 0
    def push(st, x): st.d[st.n] = x; st.n += 1
    def pop(st): st.n -= 1; return st.d[st.n]
    def peek(st): return st.d[st.n-1]
    def __len__(st): return st.n
Back to top page