Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
Interview Question I Just Gave (intermediate-advanced)
Post Body

A keyboard company wants to visualize how much each key is used. A driver stores a days worth of keys in a simple string variable available to Javascript. (You will start with a simple string of random characters).

  1. Create an object or map showing the frequency of each key pressed. Now, consider that for this exercise, all for/forEach loops are removed from Javascript. Find another way of doing it.
  2. Sort the keys by frequency.
  3. Consider the range of keypresses (e.g. 50-10000). Divide it into 10 sections. Utilizing your favorite framework (or even plain HTML to the console or DOM), generate HTML so each character is printed in a larger (e.g. >=2em) bold font, and the opacity relative to the range is set. (e.g. if the z,~,| key is lowest, it should have 1 opacity - least wear). You can use classes, style, or whatever you feel is best. Avoid the old school font attribute.
  4. Optional Bonus. Set up a 2 dimensional mapping of keyboard position to key. Print the keys as a keyboard with their order correct, and the opacity. You may have to use some CSS to move rows into position, but even if it is a simple, relative grid, that would be perfectly fine for this exercise. You can also take into account that some keys are larger than others, but optional.

Author
Account Strength
90%
Account Age
3 years
Verified Email
No
Verified Flair
No
Total Karma
20,849
Link Karma
2,866
Comment Karma
17,913
Profile updated: 5 days ago
Posts updated: 2 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago