So today’s task was so easy I’m going to do another one because I solved it way too fast. It’s really not that hard if you know some built-in data structures.
Given an n-length Array of numbers between -1,000,000 to 1,000,000, find the number of distinct values in the array.
A = [1,4,2,6,8,2,3,6] returns 6
The idea is to eliminate duplicated numbers from the Array. For this, we use a Set and then get the size of this set which finishes the solution.
const solution = A => new Set(A).size
I actually spent more time writing this than thinking about the solution😁.
King Pinn: I Salute You. I’m driving halfway across the country and this song is on repeat. Rest in Peace Tonderai Makoni. You were awesome.
After a few weeks off I’m back to business. This is just an update post detailing plans for the rest of the year.
At last we finally have the great reveal, our mystery project was implementing RSA encryption in rust.
We build the final piece of our mystery project, a function that computes modular exponentiation. Come on in, we have large numbers.
We build another part of the mystery project by creating a function that calculates the modular multiplicative inverse of a number.