Welcome back to another series of Coding for Scrubs! Today we are going to be talking about solving algorithms. This is a huge thing to know, especially when prepping for technical interviews. We are going to be learning about multiple pointers. This means we will be creating pointers or values that correspond to an index or position and move towards the beginning, end, or middle based on a certain condition.
Given a sorted array of integers and a target average, determine if there is a pair of values in the array where the average of the pair equals the target…
WELLLLLLCOME BACK TO A NEW SERIES OF CODING FOR SCRUBS. Today we are going to be talking about a problem I recently got from a code assessment.
Days in the week are represented as strings:
("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")Write a function solution that, given a string day representing the day of the week and an integer num (between 0 and 500, inclusive), returns the day of the week that is num days laterFor example, given day = "Mon" and num = 2, the function should return "Wed".
By reading the problem, we know the days…
Welcome back to PART 2 of the series, Coding for Scrubs! As previous mentioned, I’m the scrub and this series is to help me become a better coder. If the article helps you, please don’t forget to share, clap, and follow! :’)
Today, we are going to be discussing anagram palindrome in JavaScript. This particular problem was given to me in a recent technical interview.
Let’s begin!
First, an anagram is a word, phrase, or name formed by rearranging the letters of another, such as listen, formed from silent. Second, a palindrome is a word, phrase, or name formed when…
Welcome to my series called ‘Coding for Scrubs.’ I am new to the coding world so to help myself become a better programmer, I am going to break down different problems. These problems will be coming from all sorts of sources such as CodeWars, LeetCode, possible whiteboarding problems, etc. The series are mainly for my learning purposes (because hi, hello, I am the scrub. That’s what the S stands for in my name). If you’ve stumbled upon these articles, I hope you benefit from them! If you also catch any errors, please please PLEASE let me know. …
Canva is a website that is very user-friendly when it comes to creating graphic designs. You don’t have to have any pre-existing experience or knowledge to get your creativity out! All you need is just basic computer skills and the desire to create designs. If you are reading this article, you got all the skills you need already. Through this application, you can make designs for personal use, a business, education, etc. Any design that is created is yours and can be showcased in any way possible.
In order to use Canva, you have to set up an account. You…
State is a JavaScript object that stores a component’s data and determines what the component maintains. It starts with a default value and is expected to change during the component’s life. That component must keep track of its changing information.
Remember props
is a JavaScript object that is expected NOT to change. They are immutable. A component cannot change its props
, but is responsible for putting together the props of its child components.
In Ruby, we are familiar with “puts, print, p, and pp.” In Javascript, we use “console.log()” to have a return.
Ruby:
def who_lives_in_a_pineapple_under_the_sea
puts "Spongebob Squarepants!"
end
JavaScript:
function whoLivesInAPineappleUnderTheSea(){
console.log("Spongebob Squarepants!");
}
Note: Notice that calling the method is different in Ruby and JavaScript. Ruby uses “def” and “end” while JavaScript uses “function” with { } to open and close the method.
This method is a way to iterate through an array of elements in order to return, change, or manipulate them.
Ruby:
spongebob_chars = ["Spongebob", "Patrick", "Sandy", "Plankton"]
spongebob_chars.each {|single_char| puts single_char}
#=> "Spongebob", "Patrick", "Sandy", "Plankton"
JavaScript:
…
FIRST. Create a FRESH Rails application by running:
rails new [NameOfYourApplication]rails new Doggorails new AdoptDoggo
Note: the first letter should be capitalized or title-cased(the first letter of each word is capitalized).
You will now see all of the folders needed to create your application! Just double-check that schema.rb looks good or else seeding in your data will be a nightmare.
SECOND. The most efficient way to create your MVC(models, views, and controllers) and migration:
rails g resource [NameOfTable] [columnname]:[datatype] [columnname]:[datatype]rails g resource Dog name:string breed:string age:integer
Note: the name of your table should be plural and the…
Software Engineer in the making.