Untitled

Anonymous
python
02/21/2026 10:46 AM
7.0 KB
29
Indexable
class App:
    def __init__(self):
        self.stack = []

"""
def func(arguments):
    line_of_code_0 <- line_to_execute = 0
    line_of_code_1 
    line_of_code_3
"""

class FuncCall:
    def __init__(self, app, arguments, lines_of_code):
        self._app = app
        self.arguments = arguments
        self.lines_of_code = lines_of_code
        self.line_to_execute = 0
    
    def run(self):
        while self.line_to_execute < len(self.lines_of_code):
            line_of_code = self.lines_of_code[self.line_to_execute]
            
            self.execute_line_of_code(line_of_code)
            
            self.line_to_execute += 1
    
    def execute_line_of_code(self, line_of_code):
        if isinstance(line_of_code, str):
            x = eval(line_of_code)
            print(self.arguments[0], x)
        else: # run another FuncCall
            self._app.stack.append(line_of_code)
            line_of_code.run()

class Solution(object):
    """
    static/dynamic unordered array/linked_list -> find element -> linear search TC:O(N) SC:O(1)
    static/dynamic unordered array/linked_list -> convert into map / set TC:O(N) SC:O(N) -> hash search TC:O(1) 
    static sorted array -> find element -> binary search TC:O(logN) SC:O(1)
    dynamic sorted array -> heap TC:O(n*logN) SC:O(n)


    def Solution2():
        def __init__(self, array):
            # self.array = array

        def find(self, x): 
            # linear search
    
    def Solution3():
        def __init__(self, array):
            self.hash_map = {}
            for val in array:
                self.hash_map[val] = True

        def add(self, x):
            self.hash_map[x] = True

        def find(self, x): 
            # hash search
            return x in self.hash_map
    
    def Solution4():
        def __init__(self, array):
            self.sorted_array = array

        def add(self, x): # TC:O(N)
            # 1. add insert place –> TC:O(logN)
            # 2. move all element to right from insert place -> TC:O(N)
            # 3. insert new element -> TC:O(1)
            
            #.  2  
            # [1,3,5] -> [1,_,3,5] -> [1,2,3,5]

        def find(self, x): 
            # binary search
    
    def Solution5():
        def __init__(self, array):
            # self.array = array

        def add(self, x):
            self.array.append(x)

        def find(self, x): 
            # linear search
    
    # Total: TC:O(M*N) SC:O(1)
    app2 = Solution2(unordered_array) # TC:O(1) SC:O(1)
    for i in range(m): # TC:O(M*N)
        app2.find(10) # TC:O(N)
        app2.find(5)  # TC:O(N)

    # Total: TC:O(M+N) SC:O(N)
    app3 = Solution3(unordered_array) # TC:O(N) SC:O(N)
    for i in range(m): # TC:O(M)
        app3.find(10) # TC:O(1)
        app3.find(5)  # TC:O(1)

    # Total: TC:O(M*logN) SC:O(1)
    app4 = Solution4(ordered_array) # TC:O(1)
    for i in range(m): # TC:O(M*logN)
        app4.find(10) # TC:O(logN)
        app4.find(5)  # TC:O(logN)
    
    # Total: TC:O(M*N) SC:O(1)
    app4 = Solution4(ordered_array) # TC:O(1)
    for i in range(m): # TC:O(M*N*logN)
        app4.add(10) # TC:O(N)
        app5.app4(5)  # TC:O(logN)

    """


    def validStrings(self, n):
        """
        :type n: int
        :rtype: List[str]
        """
        app = App()

        main_func = FuncCall(
            app, 
            ["my_name_main"], # arguments
            [                 # lines of code
                '0+100',    
                FuncCall(
                    app, 
                    ["my_name_secondary"], 
                    [
                        "0+1000",   
                        "1000+200" 
                    ] # <- line_to_execute of secondary = 2
                ), 
                "100+200" # <- line_to_execute of main = 1
            ]
        )
        main_func.run()

        app = App(main_func)





        """"

        Company (5 focuses) -> Departament (2+ focuses) -> Track (3-5 teams) -> Team (5-10 people)
        Department:
            Principal
            Staff Staff
                Business Analytic
                Code
                RFC
                Review PRD
                Review Code

        Track:
            Sr. PM
            Sr. EM 

        Team (Objectives)
            PM – Product
                + PRD (Product requirements document)
                Experiments (A/B testing)
                ^
                |
                V
            EM - Engineering Manager != Team/Tech lead != Coding + Review Code
                ^
                |
            iOS / Android -> Mobile SWE
            Front-end (UI) -> Full-Stack (Next.js (React) -> JS + Node.JS)
            SWE / Full-Stack
                QA – unit test, auto test, ui testing, integration testing
                SRE/Oncall - 145 methods payments > 75 countries -> 3 AM to fix from PagerDuty (iPhone + SIM)
                System Analytic -> Spike
                Architector -> 
                + SPIKE
                + System Design docs (RFC)
                    + Calendar + Zoom + Meetups
                Team lead
                Tech lead
        
        Needs improvements
        Non-meet some expectations
        Good (meets expectation)    <- standard
        Over delivered
        Ultra


        Recruiter + EM (Behaviour) + SWE (Coding, System Design)

        """"
Editor is loading...
Leave a Comment