# Reviewing Objected Orientated Programming Principles: Quick Overview of The Four Pillars

Object Orientated Programming (OOP) is the approach to managing the flow of data within objects. Objects are data that we want to model from the world like for example a dog, phone, driver’s license, etc. The four main pillars for OOP are abstraction, encapsulation, inheritance, and polymorphism.

Abstraction is to only show the details to the user of the object. Only exposing the necessary details needed by whomever is using the object. A great thing from abstraction is that it decouples the user from the underlying implementation. We only care about calling the method and not the underlying implementation.

Encapsulation…

# JS Algorithm Problem: Symmetric Tree

“Given the `root` of a binary tree, we will check whether the binary tree is a mirror of itself (i.e., symmetric around its center).”

-LeetCode

Example 1:

# SQL LeetCode Database Algorithm Problems

Problem 1: Second Highest Salary

The problem states:

“Write the SQL query from the Employee Table to compute the second highest salary”

`+----+--------+| Id | Salary |+----+--------+| 1  | 100    || 2  | 200    || 3  | 300    |+----+--------+`

In the case above we should get 200 as the second highest salary. The result would look like:

`+---------------------+| SecondHighestSalary |+---------------------+| 200                 |+---------------------+`

“If there are no second highest salary available, then the query should return null.”

My Approach (First Attempt):

I first used SELECT Salary in order to grab the…

# LeetCode JS Algo Problem: Validate Binary Search Tree

Solving this medium level leet code problem was frustrating to say the least. After learning how to solve such problem, I can explain how to approach such problem.

The problem: Given the root of a binary tree, determine if it is a valid binary search tree (BST).

A valid binary search tree is as follows:

• The left subtree of a node contains only nodes with keys less than the node’s key.
• The right subtree of a node contains only nodes with keys greater than the node’s key.
• Both the left and right subtrees must also be binary search trees.

Example…

# Building Picgram: Week 2

Continuing on with building out the backend for our Picgram web app, I added the following to the Sessions Controller:

class SessionsController < Devise::SessionsController
# is where a user will authenticate his/her credentials and it will assign the JWT to the user if successful.

def create
user = User.find_by_email(sign_in_params[:email])
token = user.generate_jwt
render json: token.to_json
else
render json: { errors: { ‘email or password’ => [‘is invalid’] } }, status: :unprocessable_entity
end
end
end

As the note within the code states, this is used for the user to authenticate their credentials and by doing so it…

# Picgram: Team Project with Flatiron Alums — Week 1

Some Flatiron School colleagues and myself decided to work on a group project in order to continue to flex our programming muscles! We decided to create a Instagram web application clone and add some features of d3.js, devise, Oauth and more in order to have more experience using these tools.

As this is my first big group project, I was looking forward to bouncing off ideas with focus driven people and I was glad that was the case. The first day we planned out the backend of our application by using a whiteboard to write down the model associations, our…

# Solving Recursion Algorithm Problem

Problem 1: Recursive Digit Sum

We are given the task to solve for the super digit, which is the digit that is sum of a longer digit. Our known variables are n and k, n represents the large number that is a string and k represents the total amount of times n is concatenated. In the example below n is ‘9875’ and i is 4. The variable p is the result of concatenating n, so the amount is ‘9875987598759875’. However since this amount is in a string, we must separate the individual element from the overall string and then change…

# Coursera: Information Visualization D3.js Project Week 1 & Week 2

I’ve been learning much about D3 and its usefulness this past week. In the course so far I was able to do week 1 with no problem since it was just a JavaScript refresher course. For the week 2 curriculum, I learned about writing the code to create bar charts and label the x and y axis with information being passed down from a csv file with multiple columns of information. The assignment from this course is to gradually add more lines of code to the index.html in order to come up with a stunning and visually appealing data charts…

# Experience Learning D3 Javascript Library: Things I picked up on

I came across D3 when I was applying to a position at a media company and was asked in a code challenge to submit a bar chart with data that is within a csv file. Unfortunately I was unable to complete the challenge but it opened my eyes to what I can learn. In my previous projects I created mostly task and list tracking web apps because I’m a stickler when it comes to being organized. So writing code to produce charts was definitely out of my wheel-house. …

# Solving JS Algorithm Problem: Birthday Cake Candles

This week I will be going over a problem from Hackerrank. The problem is titled Birthday Cake Candles.

1)Birthday Cake Candles

You are in charge of the cake for a child’s birthday. You have decided the cake will have one candle for each year of their total age. They will only be able to blow out the tallest of the candles. Count how many candles are tallest. Count how many candles are tallest.

Given function:

function birthdayCakeCandles(candles) {

}

Candles represents the sample case array [3, 2 , 1, 3].

In this case, just by looking at…

## Perezchristian

Flatiron School Graduate with finance, budget, and tax experience.

Get the Medium app