A wonderful string is a string where at most one letter appears an odd number of times.

Given a string word that consists of the first ten lowercase English letters ('a' through 'j'), return the number of wonderful non-empty…


Stop the grind. Study with plan! Here’s the patterns that covers 95% of the questions you’ll see on LeetCode.

Binary Search

Overview

Sorted Array

Implicitly Sorted Array

Depth First Search

Introduction


The first step to getting a job at Google is to pass the online assessment, commonly referred as “OA”. The OA is given to candidates immediately after your application is approved by the initial screening. If you pass the online assessment, you will move on to the next round which…


The first step to getting a job at Twitter is to pass the online assessment, commonly referred as “OA”. The most common format is a test with two to three questions to complete them within 1–1.5 hours. The assessment result will be used to decide if the candidate can move on to the on-site interviews.

All Questions


The first step to getting a job at Amazon is to pass the online assessment, commonly referred as “OA”. Candidates are sent a test with 1–2 questions to complete them within 1.5 hours. …


In a string composed of 'L', 'R', and 'X' characters, like "RXXLRXRXL", a move consists of either replacing one occurrence of "XL" with "LX", or replacing one occurrence of "RX" with "XR". …


Given a complete binary tree, count the number of nodes.

Note:

Definition of a complete binary tree from Wikipedia:
In a complete binary tree every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as possible. …


Given n nodes labeled from 0 to n-1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make up a valid tree.

Example 1:

Input: n = 5, and edges = [[0,1], [0,2], [0,3], [1,4]]
Output: true

Example…


Dynamic what?

“Dynamic programming”, an awfully scary name. What does it even mean?? What’s so “dynamic” about programming?

The name was invented by Richard Bellman in the 1950s when computers are still decades away. So by “programming” he really did NOT mean programming as in coding at a computer. …


Dynamic programming is probably the trickiest and most-feared interview question type. The hardest parts are 1) to know it’s a dynamic programming question to begin with 2) to find the subproblem.

We looked at a ton of dynamic programming questions and summarized common patterns and subproblems.

We also highlighted the…

Algo.Monster

10x your algorithm interview prep speed. Take the 5-minute quiz: https://algo.monster/evaluator

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