Skip to content

Instantly share code, notes, and snippets.

View shayan-golafshani's full-sized avatar

Shayan | シャーヤン shayan-golafshani

View GitHub Profile
@mmloveaa
mmloveaa / Missing Word
Last active November 1, 2023 09:52
Missing Word
Julia and Samantha are playing with strings. Julia has a string S, and Samantha has a string T which is a subsequence of string S. They are trying to find out what words are missing in T.
Help Julia and Samantha to solve the problem. List all the missing words in T, such that inserting them at the appropriate positions in T, in the same order, results in the string S.
Constraints
1 <= |T| <= |S| <= 106, where |X| denotes the length of string X.
The length of each word will be less than 15.
Function Parameter
You are given a function missingWords that takes the strings S and T as its arguments.

What is a "data model", and how does it relate to the DOM in a front-end application?

The data model, is the state of the data that is being stored. For instance in an e-commerce-site the checkout bag is filled with items, somewhere behind the scenes in javascript that data is being stored. The data-model relates to the DOM in a front-end application, because the DOM should be dependent on the data-model and use that to display items, prices, quantities, and descriptions to the User. Additionally, sometimes the user will be interacting with the dom and as a result the data model should update a shopping cart of items, for instance. The data-model essentially becomes the state of truth and the DOM depends on the data-model to portray an accurate representation of the data. Issues can arise when the DOM & Data-Model are not in sync and nasty bugs can occur. An example of this is how movies were stored inside of the state of our app in my Rancid Tomatillos project. The Movies, Cards, and Details components used