☕Microsoft Kills Internet Explorer

Microsoft kills IE and replaces it with Edge. Edge is interesting since it is Chromium based but also has the Trident engine. We break down what this means. Plus, Khan Academy migrates to Go!

Hey Guys,

Hope you’re all having a fantastic day! Here’s your Tech Snippets, Interview Problem and Previous Solution for the day.

Industry News

Microsoft Kills Internet Explorer

Microsoft is finally killing Internet Explorer. On June 15th, 2022 Microsoft will be officially retiring Internet Explorer 11 from Windows 10. The future of browsing on Windows will be with Microsoft Edge (unless you’ve already downloaded Google Chrome… like the majority of Windows users lol).

Microsoft Edge is Chromium-based, so it uses the Blink rendering engine and the V8 JavaScript engine.

A browser rendering engine (like Blink) is what transforms HTML/CSS documents into the actual website. It builds the DOM data structure from the HTML and handles rendering (painting) based on the CSS. You can read more about Blink here.

A JavaScript engine is what executes the JavaScript code on the DOM. The V8 engine is also used in the NodeJS JavaScript runtime environment, so it’s extremely popular for server side JavaScript code too. You can read more about V8 here.

The fact that Microsoft Edge is Chromium-based makes it much easier for web developers! No more opening up Internet Explorer to find that your website is rendering incorrectly.

However, Microsoft Edge still supports websites designed for Internet Explorer! That’s because Microsoft Edge has a dual engine design, where it has the Chromium base but it also has the Trident browser engine.

The Trident browser engine is what Internet Explorer uses, and it was first developed by Microsoft in 1997. The fact that IE is Trident based whereas Chrome uses Blink is one of the major reasons why many websites work on Google Chrome but break down on Internet Explorer (and vice-versa). Read more about Trident here.

Microsoft Edge still has the Trident browser engine for any websites that were developed for Internet Explorer (mainly legacy enterprise websites) so those users can migrate to Edge too. If you want the Trident browser engine, then you switch over to “Internet Explorer mode” in Edge.

Now, developers just have to make sure their websites work on Safari (Safari uses WebKit)!

Here are the latest browser market share numbers according to StatCounter…

Chrome: 64%

Safari: 19%

Firefox: 4%

Microsoft Edge: 3%

Internet Explorer: <1%

Tech Snippets

  • Khan Academy is currently migrating their backend from a Python 2 monolith to microservices written in Go.

  • Today, they have more than 500,000 lines of Go code in production.

  • They found Go to have great tooling (fast compiler and good package management) and excellent performance.

  • In the conversion process, they’re not explicitly prioritizing performance work unless there’s a major regression. Regardless, they’ve found performance to exceed Python 2.

  • The main con with Go is the lack of Generic types. However, generics are on the roadmap for Go and will be added soon.

Interview Question

You are given two sorted arrays and a positive integer k.

Write a function that computes the k-th smallest element of an array that consists of the elements of the initial two arrays arranged in sorted order.

Remember, you’re only given the two initial sorted arrays.

There may be duplicate elements within and across the input arrays.

Can you do better than the obvious linear time solution?

We’ll send a detailed solution tomorrow, so make sure you move our emails to primary, so you don’t miss them!

Gmail users—move us to your primary inbox

  • On your phone? Hit the 3 dots at the top right corner, click "Move to" then "Primary"

  • On desktop? Back out of this email then drag and drop this email into the "Primary" tab near the top left of your screen

Apple mail users—tap on our email address at the top of this email (next to "From:" on mobile) and click “Add to VIPs”

Previous Solution

As a refresher, here’s the last question

You’re given two strings s and p. Both strings will not be empty.

Find all the start indices of p’s anagrams in s.

Example 1:

Input: s: "cbaebabacd" p: "abc"Output: [0, 6]Explanation:The substring with start index = 0 is "cba", which is an anagram of "abc".The substring with start index = 6 is "bac", which is an anagram of "abc".

Example 2:

Input: s: "abab" p: "ab"Output: [0, 1, 2]Explanation:The substring with start index = 0 is "ab", which is an anagram of "ab".The substring with start index = 1 is "ba", which is an anagram of "ab".The substring with start index = 2 is "ab", which is an anagram of "ab".

Solution

This question uses the Sliding Window technique.

We create a “sliding window” of all the characters in p.

The sliding window will just be a hash table with the characters in p as the keys and the character counts as the values.

When we add the character counts, we’ll add them as negative values. So if the character c appears in p 3 times, then c’s value will be -3.

When we iterate through s, we’ll be incrementing the sliding window’s value for the character counts whenever we come across the character.

We do this because we want our sliding window to be empty if the sliding window is an anagram of p. This way, we can tell if we have an anagram in O(1) time (since it only takes constant time to tell if a hash table is empty.

After creating the sliding window, we iterate through s.

Our sliding window will always be the same length as p. So for each iteration, we have to add the next character in s and remove one character from the window (we remove the character that is len(p) elements behind from the character we added).

When we add a character to our sliding window, we check if the character is already in our sliding window.

If so, we’ll increment it’s count. Otherwise, we’ll add it to the sliding window with a count of 1.

If the count of the character is 0, then we’ll delete it from our sliding window.

Then, we have to remove the character from our sliding window that is len(p) elements behind.

If that character is in our sliding window, then we’ll decrement it’s value.

Otherwise, we’ll add it to our sliding window with a value of -1.

If the value of that character is now 0, then we’ll delete it from our sliding window.

Now, we check if our sliding window is empty. If it is, then that means we currently have an anagram of p and we’ll add it’s indices to an indice array.

After we iterate through all of s, we can return our indice array.

The time complexity is O(p + s) and the space complexity is O(p).

You can view the Python 3 solution with comments and test cases here.