How Destination Elevator Algorithms Are More Efficient

For the last few weeks, I’ve been on vacation. My husband and I are spending some time in the lovely city of San Francisco and getting some much-needed sun. I’ll admit I haven't been coding much and being a developer is not the priority this month. However, I’m here. Writing this blog. Because I simply can't escape it and my curiosity got the better of me.

This time, it was elevators. I went to visit a friend and she lives in a tall building near downtown San Francisco. I walked up to the elevators and had a rather confusing experience…

Performance Cost of Using If Statements and Branch Predictor

I was practicing my algorithm and data structures on LeetCode when I ran into something intriguing about “If” statements. I had the following code:

for (let i =0; i<m; i++){
for (let j =0; j<n; j++){
if (matrix[i][j]%2 != 0) count++

I was looping over every element in a 2D array and increasing the count if the value was odd. Quite simple, and in my head, I wanted to increase the count “if” a condition was true so I used the if statement. My solution worked and Leetcode gave me the following statistics:

  • Runtime: 92 ms, beats 46.58…

Why You Need Career Shifters Like Me


While continuing my Udemy course on web development, I came across an interesting concept. The instructor explained an architectural decision he had made, he was going to use the CQRS pattern. The comments section was flooded. Why use that pattern? Why not use plain CRUD? Are there other alternatives? To address this, the instructor brought up the golden hammer anti-pattern which essentially says there isn't any one pattern that will work for everything.

The Golden Hammer? What Is It?

The golden hammer in software development is an anti-pattern. A common response or practice that is considered bad practice and is usually ineffective. …

Two Pointer JavaScript Solution Walkthrough

I’ve been gaining confidence in my algorithm solving skills. So much so that I’ve graduated to the medium difficulty Leetcode problems. Yay! Can I effortlessly solve every problem I see? Hell no! I'm at the stage where given the problem I can normally come up with a working brute force solution. However, when it comes to finding the most optimized answer, I usually look for a few hints. But that's ok! …

Cost-benefit analysis and red flags to be wary of

Photo by olia danilevich from Pexels

A couple of weeks ago I had my first take-home coding challenge as part of the interview process for a company. I started researching take-home challenges to learn some tips and make sure I was following best practices. After I read some personal experiences of developers doing take-home challenges, I realized I had no idea how controversial this topic is! I came across many blogs and Reddit posts of people who are completely against them on principle and others where people defended it as the best way to determine a candidate's abilities.

What Is It?

A take-home assessment, challenge, or assignment is a…

Identifying Edge Cases in Algorithms and Applications

It's such a joyous feeling when you finally get your solution to an algorithm to work. Or when your web application correctly works the way you want it to. But then… someone asks the questions “but what if I tried to do this?”, “what would happen if we change this”, “how does your solution handle this?”

Edge cases are the worst!

What is an Edge Case?

An edge case (or sometimes called boundary case) is a problem that occurs at the extremes of your operating parameters. To expand that definition to explain how it's normally used in tech, an edge case is a situation (might…

Leetcode Problem: Linked List Cycle


While going about my algorithm practice, I came across an interesting concept that I definitely wish I had seen earlier. I knew about pointers, and how having two pointers can sometimes help you solve a problem; basically keeping track of where you are in a linked list, or array, or graph but at two different locations. However, I had only ever used them to start at different parts of the data structure, or by keeping one static while one of them moved. I have never considered moving them at different speeds! …

Tips for Translating and Porting Code

This week I was building out a web service. I wanted to implement a specific algorithm as part of the service, but I am a strong believer in “don't reinvent the wheel”. Surely the piece of code I needed existed somewhere and I just had to find it. So I scoured the internet and to my disappointment, I was only able to find an implementation of the algorithm in a different language. I found a Javascript implementation, however, my web service was being built on a Ruby framework. Then this got me thinking about translating or converting code between languages.


Drawbacks of Recursive Solutions

When it comes to practicing data structures and algorithms, I often find myself avoiding recursion. Recursion is not my favorite and it's definitely not a strong point. But we have to practice to get better, so I’ve been doing just that.

Recursion is a repetitive process in which a function calls itself.

In recursion, you will see the function calling itself inside the function. To write a recursive solution to a problem, you need these two steps:

  1. Design the base case that will stop the function from calling itself
  2. Design the procedure where the function will call itself (possibly with…

7 Goals for 2021 As I Continue My Software Journey

We did it! We made it to 2021! A brand new year filled with potential and hope. About this time last year, I had decided to do a career switch and join the world of software development. The past year was spent working hard, learning, and meeting new people. I am very excited to continue this journey. The start of the new year allows for some time for reflection and realigning our goals. …

Sara Khandaker

I love seafood, exploring new cities, board games and learning to love to code.

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