A wonderful string is a string where at most one letter appears an odd number of times.
"abab"are wonderful, but
Given a string
word that consists of the first ten lowercase English letters (
'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.
Implicitly Sorted Array
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.
In a string composed of
'X' characters, like
"RXXLRXRXL", a move consists of either replacing one occurrence of
"LX", or replacing one occurrence of
Given a complete binary tree, count the number of nodes.
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. …
n nodes labeled from
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.
Input: n = 5, and edges = [[0,1], [0,2], [0,3], [1,4]]
“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…