This week I learned about Binary Search Trees (BST)and I came across a particular problem that helped me understand the difference between the Breadth-First Search (BFS) and Depth-First Search (DFS) and how their implementation can be modified according to need.

The practice problems I worked on is “Kth smallest element in a BST” (https://leetcode.com/problems/kth-smallest-element-in-a-bst). The task is simple; find the specified element and return its value.. sounds simple enough…


I recently started practicing algorithms with some friends on a new site binarysearch.io (allows you to create a room and invite people to join and code in your own tab and look at each others code after you solve it or 10mins) and I came across the question Autocomplete (https://binarysearch.io/question/11), where you get a set of words and a string as your inputs. Your task is to return the words that could be what the user is looking for given the input string s.

After a little thought, I decided my approach was to combine looping with logic to come…


I recently decided to learn Python to add to my stack (JS, Ruby) given the popularity of the languages across many industries. I’m writing this in hope that it can help others who are learning python with some coding background (I know JS/Ruby).

# Stringssentence = 'Hi i am a string'
type(sentence) # return <class 'str'>

Strings are pretty straight forward, just like any other language, you define them with single quotes (‘ ’) or double quotes (“ ”), unlike JS back ticks (` `) won’t work in python.

# Boolean  boolean = True # type boolean…

As I start learning Python, I find it useful to compare it to a current language that in know already, in this case it’ll be Javascript. Once I learned the basics of Python variables, functions and if/else statements (check out this blog post for more on Python basics), the next step was to put it to use in a simple problem by solving it in Javascript and then code the same answer in Python to experiment with the differences in the syntax.

The problem is an easy one: determine the minimum distance between two duplicate elements of an array. …


This week I was working on a LeetCode problem in which I had to extract an integer from a string. Here’s the link to the problem: https://leetcode.com/problems/string-to-integer-atoi/

Your input is a string composed of numbers, strings, and spaces and you have to take the sting, ignore the spaces and numbers and only take out the first number in the string, but if the first character is a letter, or if there aren’t any numbers (only spaces) then you return 0. Also, if the number is above above or below a predetermined max/min, replace that number with the max/min.

My approach…


One type of data structure you can use when solving algorithms is a stack. A stack is a linear structure where adding or removing of an element follows a particular order: LIFO (Last In First Out) or FILO (First In Last Out).

I’ll be using a sample problem from LeetCode called Valid Parentheses

In this problem you receive a string of characters that can only be “()”,”[]”,”{}”, and you must create an algorithm to check if the string is valid (i.e. …


My most recent project called UNO-Y-MEDIO, it’s software version of UNO with a front end built with Javascript and React (Redux for state management). My first major challenge to tackle was to develop the gameplay logic, which I was really excited for.

Getting the game to accept a card of the same color or value was the easy part. The challenge was to manage the effect of the other cards: reverse, skip, plus 2, wild card, plus 4 wild. The way I went about this was to use the redux store to keep track of that status of the game…


My most recent project called UNO-Y-MEDIO, it’s software version of UNO with a front end built with Javascript and React (Redux for state management). After developing the gameplay logic and the computer player to work with all 4 players (I talk about that in another post), my next challenge was to figure out the card animation.

From the beginning, one of my stretch goals was to develop animation for the cards where you can see the card go from the deck to the respective hand and from the hand to the pile when it’s played.

As you could imagine, I…


My most recent project was to create a software version of UNO, with a front end built with Javascript and React (Redux for state management). I had developed the gameplay logic to work with human players and the next step was to create 4 computer players to play the game so the game could be played without humans. Upon creating the computer player logic, it would proceed to break the game every time.

I started by checking the computer player logic to make sure that it was looking for the right attributes, then proceeded to the game play logic. While…


When I first started learning Javascript, I learned to use var to declare a variable and used it until I learned about let and const. Which led me to wonder the difference between the three. I learned that there are two aspects in which they differ: declaration/assignment and scope

Declaration/assignment:
When you declare a variable and assign it a value, the type you choose (or don’t choose) will depend on what you want to do with it later on.

  • VAR — can be declared again and be assigned another value
  • LET —cannot be declared again, can be assigned another value

Carlos Pineda

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store