This was a Apple iCloud team phone interview problem
Tuesday, April 27, 2021
React Tic Tac Toe Game
Labels:
Atoms,
Game,
Interview,
Javascript,
React,
Web development
Monday, April 26, 2021
Implement getElementsByClassName
Dropbox Interview Problem
Implement getElementsByAttribute
Sunday, April 25, 2021
Mock API layer data using promises, async/await, setTimeout
Labels:
API Client,
async,
await,
Javascript,
Promise
BST insertion
Next greater element i
Saturday, April 24, 2021
More LinkedList functions in JS
Friday, April 23, 2021
Find corresponding Node of a second tree, given the node of a tree
Apple Phone Interview Question
Someone recently asked me what's the point of such questions where you get something from one tree and find something based on it in a second tree. Such kind of algorithms are useful for libraries like React. React is a UI development library that has optimized rendering for the browser.
The browser renders HTML in the form of DOM (Document Object Model) tree. Any update to the DOM is cascaded down this tree (involves tree processing complexity) and then the browser re-paints the changes. And these operations on the DOM tree are all pretty expensive.
What React does is to create a copy of the HTML DOM - this copy DOM tree is called the Shadow DOM. Any update you make to the DOM is first made on the Shadow DOM and then all the updates are batched together and sent to the actual HTML DOM. As a result, the number of times the browser re-paints the DOM is highly reduced. Thus using React provides you with faster/optimized renderings.
In order for React to do what it does with it's own shadow tree and the HTML DOM Tree, it needs to do things with one tree and transfer it to the other tree.
Classes & functions in JS
Interview details: Salesforce Manager Coding round
Labels:
Class,
EventListeners,
Interview,
Javascript,
OOP
Thursday, April 15, 2021
Implementing Custom Event listeners
Labels:
Class,
EventListeners,
Interview,
Javascript,
OOP
Wednesday, April 14, 2021
Maximum Depth of Binary Tree
Tuesday, April 13, 2021
Pangram
Labels:
Algo,
Interview,
Javascript,
React,
Web development
Monday, April 12, 2021
Closures with let and var lexical context
Subdomain visit count
Thursday, April 8, 2021
Most Frequent Subtree Sum
Tree Path Sum
Monday, April 5, 2021
Sunday, April 4, 2021
Subscribe to:
Posts (Atom)