Photo by Pierre Châtel-Innocenti on Unsplash

Let’s talk about a Sliding Window problem and how to solve it.

The Sliding Window approach is useful when you have a set of data (like a string or array) and you are looking for a continuous subset of the data. We create a window (which can be a subarray or substring) and move the window depending on a condition.

Consider the following problem: Write a function which accepts an array of integers and a number called w. The function should calculate the maximum sum of w consecutive elements in the array.

Brute force solution — O(nw)

The brute force approach would be to use…

brightcode.dev

I recently joined a class at BrightCode called Programming in an Enterprise Environment. It’s geared towards those with 3–18 months of programming experience. The purpose is to get some experience working on an existing project and adding features or changing layouts. Most developers learn to code by creating their own projects, but in a job as a developer, we will most likely be adding to an existing codebase.

As stated on the BrightCode website:

the class emphasizes best practices in developing readable and maintainable code.

Some of the things that I have learned so far include using SCSS.

In SCSS…

Dynamic programming is a method for solving a complex problem by breaking it up into smaller subproblems, and store the results of the subproblems for later use (to reduce duplication).

This article on GeeksforGeeks explains:

Wherever we see a recursive solution that has repeated calls for same inputs, we can optimize it using Dynamic Programming.

Let’s start with the Fibonacci numbers.

The Fibonacci numbers is the sequence 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 … where each number in the sequence is found by adding up the two numbers before it.

Note: It is sometimes written 1…

This is the third part of a blog series describing what I have learned about CSS flexbox by playing an educational game called Flexbox Zombies. If you haven’t read the others yet, you may want to read part 1 and part 2 first.

Flexbox Zombies

As I mentioned in the first two parts of the series, MDN docs explain flexbox as:

a one-dimensional layout method for laying out items in rows or columns. Items flex to fill additional space and shrink to fit into smaller spaces.

The Flexbox Zombies game teaches flexbox through a story, with each lesson building on the previous…

This is the second part of a blog series describing what I have learned about CSS flexbox by playing an educational game called Flexbox Zombies. You can read part 1 here.

Flexbox Zombies

As I mentioned previously, MDN docs explain flexbox as:

a one-dimensional layout method for laying out items in rows or columns. Items flex to fill additional space and shrink to fit into smaller spaces.

The Flexbox Zombies game teaches flexbox through a story, with each lesson building on the previous, thus reinforcing the fundamentals of flexbox in a fun and effective way.

Here are the steps that I’ve learned…

Flexbox Zombies

I started playing an educational game called Flexbox Zombies, which has been teaching me the fundamentals of flexbox in a fun way. In the game, you fight zombies by using features of flexbox to aim your crossbow at the zombies.

MDN docs explain flexbox as:

a one-dimensional layout method for laying out items in rows or columns. Items flex to fill additional space and shrink to fit into smaller spaces.

The Flexbox Zombies game teaches flexbox through a story, with each lesson building on the previous, thus reinforcing the fundamentals of flexbox in a fun and effective way.

Here are…

I recently had a mock technical interview through Skilled where I was paired with an interviewer and given code challenges in Javascript and React.

Part of my solution to one of the problems I was posed included checking if a key exists in an object.

The way I implemented this was by using the following:

if (myObj["keyName"]){  // or myObj.keyName
// do something
}
else{
// do something else
}

My solution was effective, but the interviewer taught me that another way I could check is by using myObj.hasOwnProperty(“keyName”).

I hadn’t encountered the hasOwnProperty() method before, and was eager to…

In my most recent project, a project management app using React, Redux and Rails, I added the ability for a user to upload images via Cloudinary. I followed the steps in this detailed walkthrough to set up the file upload functionality. After implementing the upload capability, I also wanted to implement the ability to remove the files, not only from the Rails database, but from the cloud as well. After all, once a file is deleted from the database and thus no longer being used, why bother storing it in my limited cloud space?

The article briefly mentioned the necessary…

Useful methods of the Math object

Javascript provides a convenient built-in Math object that has properties and methods that aid in performing mathematical calculations.

As explained by w3schools:

Unlike other global objects, the Math object has no constructor. Methods and properties are static.

All methods and properties (constants) can be used without creating a Math object first.

Properties

The Math object’s properties include various constants. One example is π which can be accessed by writing Math.PI.

const radius = 3;
const circumference = 2 * Math.PI * radius;
console.log(circumference)
// expected output: 18.8495....

In this article we will discuss one way to easily create a navbar that can be incorporated into all pages of your Rails app.

Rails app skeleton and where to put the navbar code

Rails initial file structure

When we create a new Rails app using rails create new-app, a lot of files are created for us. To see the full directory structure and explanations of each directory, check out this article.

We are going to focus on the app folder (structure shown below).

. |-- app | |-- assets | | |-- images | | |-- javascripts | | | `-- application.js | | `-- stylesheets | | `-- application.css | |-- controllers…

Elisheva Elbaz

Software Engineer | Full Stack Developer

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