# Data Structures

## Let’s Invert A Binary Tree

If  you are familiar with the stories of software engineering interviews at the big tech companies like Google, then you have probably heard of or seen this tweet by Max Howell, the founder of Homebrew. Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a …

Hi there :), our question for today is from code signal, and it’s an easy problem. Given an array of integers, find the pair of adjacent elements that has the largest product and return that product. Example For inputArray = [3, 6, -2, -5, 7, 3], the output should be adjacentElementsProduct(inputArray) = 21. 7 and 3 produce the largest …

Question There is a robot starting at position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, judge if this robot ends up at (0, 0) after it completes its moves. The move sequence is represented by a string, and the character moves[i] represents its ith move. Valid moves are R …

## The Longest Common Prefix Amongst An Array of Strings – Implementation in Javascript and PHP

Today, we’ll take a look at another easy problem on leetcode, finding the longest common prefix string amongst an array of strings. Question Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string “”. Example 1: Input: [“flower”,”flow”,”flight”] Output: “fl” Example …

## Two Approaches to Solving The TwoSum Problem – Easy Javascript Implementation

If you’ve been practicing some data structures and algorithms, then you have probably come across the TwoSum problem. It’s a popular and easy question to help you get started. The problem can be asked in multiple ways. We’ll go for the generic question as seen on leetcode. Question Given an array of integers, return indices of …

## A Singly Linked List Implementation In Javascript

Once you start exploring data structures outside of arrays, you’ll probably if not certainly bump into lists first. A list is an abstract data type (a type for objects whose behaviour is defined by a set of value and a set of operations) that represents a countable number of ordered values, where the same value …