Harry Potter lose Invisibility Cloak run school caretaker Filch Finding invisible object easy task fortunately Harry friend willing help Hermione Granger read the Invisibility cloak everything they volume the Encyclopedia Quick Search Shortest Paths Graphs Network Flows Maximal increase Subsequences other Magical Objects she develop search algorithm invisibility cloak complex dynamic system Hogwarts themhogwart consist n floor number integer 1 n some pair floor connect staircase the staircase change position move exactly end Formally situation like staircase connect floor b modify position connect floor c b c c floor different b under circumstance staircase connect floor at time multiple stair pair floorsinitially Harry floor number 1 he remember floor lose cloak want look floor therefore goal visit n floor Harry visit floor order finish search floornowadays staircase rarely however Ron Hermione willing spell help Harry find cloak to cause suspicion friend plan staircase staircase in shift staircase Harry able floor reachable moment staircase look Invisibility Cloak it assume time staircase spontaneouslyhelp friend compose search plan if variant solve problem valid option necessarily optimal accept