• Skip to main content

Daniel Leskosky

Here to Learn

  • Blog
  • Projects
  • About
  • Contact

Main Content

Here to Learn

Daniel Leskosky

The k-th Lexicographical String of All Happy Strings of Length n

March 2, 2021 | 0 Comments

It is important to always strive for the best time complexity when solving algorithm problems.  I recently solved for the brute force solution to this problem and was ready to move on.  Then, a fellow programmer on the world-wide-web reached out to me and encouraged me to do better!  He showed me a solution that was much better than mine.  The only problem was that I didn’t understand it at all.  Well, now I do understand it.  AND I want you to understand it too!

Read More

Path in ZigZag Labelled Binary Tree

February 15, 2021 | 0 Comments

Every so often when I am practicing algorithm problems, I run into a problem that requires a bit of math to solve.  For this “Path in ZigZag Labelled Binary Tree” problem, my initial impression was that I would have to do a breadth-first search on a tree.  As I quickly found out, I was not dealing with a typical tree problem.  This problem requires a bit of math to solve.  I don’t know about you, but my math is a bit rusty.

Read More

Largest Rectangle in Histogram

February 1, 2021 | 0 Comments

I was working on a LeetCode problem a few days ago.  I was able to come up with a brute force solution, but wasn’t able to get any further past that.  On the discussion board a user gave a solution that utilized histograms.  The user also referenced another problem for more histogram practice.  I don’t know about you, but I could use some more histogram practice.  Let’s figure out how to solve “Largest Rectangle in Histogram”.

Read More

Dutch National Flag Problem

January 17, 2021 | 0 Comments

I was going through LeetCode problems that I have solved, looking for one that would be good to write a post about.  I came across the Dutch National Flag Problem and knew right away that it would be a good one.  Let’s learn how to solve it!

Read More

Reveal Cards in Increasing Order

January 3, 2021 | 0 Comments

Although I continue my practice of algorithms, I am still having trouble identifying when to use the appropriate data structure.  I recently attempted to solve a problem on LeetCode and completely missed the obvious hints that a queue would be a good data structure to use for the algorithm.  This post will provide a detailed solution with illustrations for that problem.  While the main purpose of this post is to help others get a clear mental picture of what is happening with the algorithm, I also write this post with the hope that I can work to strengthen my intuition of when to leverage the correct data structure.

Read More
  • 1
  • 2
  • 3
  • …
  • 5
  • Next »

© 2021 Daniel Leskosky