Microsoft frontend engineer interviews emphasise JavaScript, DOM manipulation, CSS, accessibility, browser APIs, and UI component architecture.
Router class should support the following methods:addRoute(path: string, handler: Function): void: Adds a new route with its corresponding handler function.navigate(path: string): void: Navigates to the specified path and invokes the associated handler.Example 1:const router = new Router(); router.addRoute('/home', () => console.log('Welcome to Home')); router.navigate('/home');Welcome to Home/home and then navigating to it triggers the corresponding handler.Constraints:100 routes can be added.LRUCache class with the following methods:get(fileID: int) -> str: Retrieves the file content for the given file ID and updates its usage.put(fileID: int, content: str) -> None: Stores the file content in the cache. If the cache exceeds the size, remove the least recently used file.Example 1:const lruCache = new LRUCache(2); lruCache.put(1, 'File1'); lruCache.put(2, 'File2'); lruCache.get(1);'File1'3000 files.fileID will be unique.Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free