Software Engineering Student at Flatiron NYC. Learning day by day 💻

# Algorithm Problem Review #5: Arrays and Candy

A new week and a new problem. I found this problem on LeetCode. I had fun with this problem mainly because it had something to do with sweets.

# Problem 1431: Kids With the Greatest Number of Candies

Given the array candies and the integer extraCandies, where candies[i] represents the number of candies that the ith kid has.

For each kid check if there is away to distribute extraCandies among the kids such that he or she can have the greatest number of candies among them. Notice that multiple kids can have the greatest number of candies

# Example

Input: candies = [2, 3, 5, 1, 3], extraCandies = 3 Output: [true…

# Frequently Used React Native Components

***Disclaimer: If you are just getting started with React Native and have not set up your first React Native project yet, read my blog on how to getting started***

React Native has built-in components for us to use when making our apps. They can be found in the React Native documentation here. Don’t feel limited to these built-in components, we also have access to component libraries that have been created by the community of developers that we can access here.

To use one of the built-in components, you must import it from the react-native library at the top with the…

# Algorithm Problem Review #4: Multiple Pointers

Another week and yet another algorithm problem from the Colt Steele Udemy course. This week I was working on multiple pointers, a technique I can use to solve problems without having to doubly loop. Instead, I would create pointers that would correspond to an index or a position and then move that pointer in any direction I need based on a condition.

# Multiple Pointers — countUniqueValues

Implement a function called countUniqueValues, which accepts a sorted array, and counts the unique values in the array. There can be negative numbers in the arry, but it will always be sorted

## Example

Inputs: [1, 1, 1, 2]
Output

# What is React Native?

React Native is a mobile development framework written in JavaScript. It uses React.js which is a JavaScript library for building user interfaces. It also has its own special components that know how to communicate with the native device’s platform so you can build a user interface. Mobile devices don’t use HTML tags so React Native gives us those components that can render our user interface. It gives us access to the device’s API like the device’s camera, and more.

It gives us everything we need to create a real mobile app that we could have in the IOS and Andriod…

# Algorithm Problem Review #3: Anagram

This week I was working on another algorithm problem from my Colt Steele Udemy course. This is another frequency counter type problem but this time I’m working to see if two strings are anagrams of each other.

# Frequency Counter — validAnagram

Given two strings, write a function to determine if the second string is an anagram of the first. An anagram is a word, phrase, or name formed by rearranging the letters of another, such as “cinema”, formed from “iceman.”

## Example

Inputs: string1=“ ” , string2=“ ”
Output: true

Inputs: string1=“aaz” , string2=“zza”
Output: false

Inputs: string1=“anagram” , string2=“nagaram”
Output: true

Inputs: string1=“awesome” , string2=“awesom”…

# Algorithm Problem Review #2

This week I was worked on an algorithm problem I came across on one of my Udemy courses by Colt Steele. I worked on how to problem-solve common algorithm question types. In particular how to turn an algorithm that would’ve been O(n²) if solved naively to an O(n) notation by using javascript objects instead of having a loop inside of a loop.

# 27. Frequency Counter Pattern

Write a function called same, which accepts two arrays. The function should return true if every value in the array has its corresponding values squared in the second array. The frequency of values must be the same.

Examples…

# Leetcode Problem Review #1

I’ve decided that I will start reviewing some of the algorithm problems I come across while practicing on LeetCode.

# Problem 1480: Running Sum of 1d Array

Given an array nums. We define a running sum of an array as runningSum[i] = sum(nums[0]…nums[i]).

Return the running sum of nums.

## Example

Input: nums = [1,2,3,4]
Output: [1,3,6,10]
Explanation: Running sum is obtained as follows: [1, 1+2, 1+2+3, 1+2+3+4].

## Constraints

• 1 <= nums.length <= 1000
• -10^6 <= nums[i] <= 10^6
var runningSum = function(nums){};

# My Process

## Understanding the Problem

The first thing I did before coding anything was to make sure I understood what the problem was. The examples provided did a pretty good job at…

# Big O — Time Complexity Graph Simplified

When I began my journey in learning algorithms to become a better coder, this was the first big lesson — “Big O”. The name was daunting enough but after watching several videos and seeing in action how important Big O is, I wanted to explain it in one blog.

So Big O is all about “time complexity” (will be omitting space complexity in this blog). It gives us a numeric value (O notation) of how well our code performs, especially in a worst-case scenario of our input being a very large number or an array.

The problem with measuring how…

# How to: Action Mailers in Rails Backend

Have you ever wanted to send out emails from and app you’ve created?

Well I’m here to show you how! With Rails ActionMailers you can start sending emails to users, in less than 15 minutes! Let me show you how.

We’re going to create an app where a user gets an email from us when they sign up for an account with us.

First thing you want to do is run the rails generator to create your Mailer like so: rails g mailer <name_of_mailer>.

rails g mailer new_user

After this code is ran, two files are created:

• app/mailers/new_user_mailer.rb
• app/views/new_user_mailer

The…

# JavaScript: Invoking, Referencing and Callback Functions Explained

The transition from Ruby on Rails to JavaScript was not as bad as I thought it would be. In fact, they share a lot of similarities. For one, functions was very similar to Ruby’s methods. Though there are some core differences that I’d like to discuss about JavaScript’s functions.

# Referencing a Function

In Ruby we can call a method by writing its name. If we do so in ruby, we are only referencing the function’s definition. For example:

Get the Medium app