Tag: JavaScript

  • Word Reversal Code Challenge

    Word Reversal Code Challenge

    Here’s the scenario, you are given a string s that contains a sentence and your task is to write a word reversal function to reverse the order of all words that are longer than n characters. Example: s = The quick brown fox n = 4 Then the result should be “The kciuq nworb fox”…

  • A story about Storybook

    A story about Storybook

    Storybook is a fascinating piece of software that allows pain-free React development. We started using it at djangsters, and I wrote our thoughts about it here. This is a brief summary, and I will be writing a more detailed post both on Medium and here so follow me on Twitter @phoexer or @djangsters not to…

  • is DOMRect not serializing for you?

    is DOMRect not serializing for you?

    Today I was writing a playwright test that needed to do some calculations on an element’s coordinates. No problem right? Just get the DOMRect object from getBoundingClientRect and go about your day. Easy, expect that rect was an empty object. It took me a second to figure out, but it appears that DOMRect is not…

  • Code Corner: Bracket Matching

    Code Corner: Bracket Matching

    Problem Given a string with brackets check to see if the brackets are properly nested. Source Example [] = return 1 () => 1 )( => 0 ({)} => 0 ” => 1 My Solution Classic stack problem. Didn’t need to brute first. The idea is you create a stack and loop through each character…

  • Code Corner: Max of 3

    Code Corner:  Max of 3

    Problem Given an n-length Array of integers ranging from -1000 to 1000 find the largest product of three numbers in A that you can get. Source Example [-3,2,6,4,8] => 192 My Solution There are three basic scenarios that can produce the largest product: The largest three positive numbers The largest positive number and the smallest…

  • Code Corner: 1-minute rule

    Code Corner: 1-minute rule

    So today’s task was so easy I’m going to do another one because I solved it way too fast. It’s really not that hard if you know some built-in data structures. Problem Source Given an n-length Array of numbers between -1,000,000 to 1,000,000, find the number of distinct values in the array. Example A =…

  • Code Corner: More Array Hijinks

    Code Corner: More Array Hijinks

    Problem We have another array operations question. This time we are given two inputs, a number n and a 2d array of operations. Each of the operations has 3 values, a start index, an end index and an increment value. Source: HackerRank The task is to implement each of those tasks on to a new…

  • Code Corner: Counting Operations

    Code Corner: Counting Operations

    Problem Codility MaxCounters We are given a number n and an array A of length m where each value in A is less than n+1 and greater than or equal to 1. We have to create a function that executes two operations using a new array of length n with initial values 0. The array…

  • Evolution of Code Style

    Evolution of Code Style

    When I started programming I developed a particular code style. This style was defined by how I structure my code, how I name things etc and was heavily influenced by the senior developers I worked with. Over the years I developed my own personal style which was evolved with every project I did and every…

  • Code Corner: Missing Number

    Code Corner: Missing Number

    Problem Source: Codility Given an array A of length n filled with integers find the smallest missing positive number. Example: [4,8,1,3,2] => 5 [1,2] =>3 Restrictions n ranges from 1 .. 100,000 Values of A range from -1,000,000 to 1,000,000 My Solution As usual, I decided to first take a brute force approach. As a…