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
Code language: JavaScript (javascript)
And done.
I actually spent more time writing this than thinking about the solution😁.
Today I am working on a summation problem made to look like building a tower out of cubic bricks. It’s fun to brute force sometimes.
Coming back to Rust code after a bit of a hiatus with a simple problem… The Two-sum problem. Finding numbers in an array. Yay, fun.
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.