1. Knuth-Morris-Pratt Algorithm and

2. Divisors + Rabin-Karp

Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. …


  • If the character read is a letter, that letter is written onto the tape.

struct Node {
int val;
Node *left;
Node *right;
Node *next;
}

Input: [1,2,3,null,5,null,4]
Output: [1, 3, 4]
Explanation:
1 <---
/ \
2 3 <---
\ \
5 4 <---


    3
/ \
9 20
/ \
15 7
There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24.
#…

  1. Its good to point out the differences in the space complexity of the BFS (using…

Problem

Top view of a binary tree is the set of nodes visible when the tree…


Technical Interviews Preparation

Currently preparing for interviews

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