Using the Data.List Module

Manipulating arrays and lists are a big part of coding. Coming from JavaScript I was spoiled with the many many built-in array functions available. From map to sort to filter. These are basic building blocks I needed to continue coding in Haskell. That's when I came across the Data.List module.

Data.List

Data.List is a Haskell module, or a collection of related functions, types, and typeclasses. This module contains many useful functions for dealing with lists. To import the module, simply include the following at the top of your file (before you use any of the functions from the module):

import Data.List


What To Say When You Don't Know The Answer To An Interview Question

I really hate not knowing the answer. I also hate not knowing what to say. But, it really doesn't matter how much you prepare for your interviews beforehand. The situation is bound to come up. The interviewer asks you a question and you simply don't know the answer.

Do you know what I do in that situation? I get very flustered, probably throw in a nervous giggle or two, and then respond. It's not pretty. However, something I keep reminding myself, an interview is a conversation. By following up the “I don't know” with more context you can help direct…


JavaScript Solution Using Level Order Traversal

What's the secret to being an algorithms master? Well, I don't know, I haven't even completed a LeetCode Hard problem yet. But I’ll tell you my strategy for getting better at them: see every single problem that exists.

Ok, that's obviously not possible. But the more you see the better! Also, you don't really need to see every problem, but rather every single type of problem. Have you ever heard the saying “There's no such thing as an original idea”? Apparently, Mark Twain said that; I had to google it. But that's the idea behind algorithms as well. They all…


Functional Programming and Haskell

Let's continue on the functional programming journey this week. One of the biggest things that scared me about learning Haskell and Functional Programming was that I had heard that they don't use loops. No loops!? That's crazy, I code with loops left, right, and center. What do you mean there are no loops? It's such a basic fundamental tool. Also, why don't we use them? What do you do instead? This was very overwhelming as you can see. Below I’ll summarize my understanding of why functional programming languages usually emphasize the use of recursion (or higher-order functions) over loops and…


My Intro into Functional Programming

It's been a long time since I’ve written a blog! I had a wonderful vacation but I just know everyone is dying to know what my next project is. It's Haskell! This week I’ve been learning the basics of functional programming and Haskell. But Sara, why are you moving away from Object-Oriented Programming? Why Haskell?

That’s a good question. The chart below ranks programming languages based on the PYPL PopularitY of Programming Language Index. This is determined by analyzing how often tutorials for a specific language are searched on Google. Where is Haskell? …


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 from

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…

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