Open in app
Home
Notifications
Lists
Stories

Write
Technical Interviews Preparation
Technical Interviews Preparation

Home

About

Jan 19, 2021

K Closest Points to Origin — Leetcode Medium

973. K Closest Points to Origin Medium : https://leetcode.com/problems/k-closest-points-to-origin/solution/ We have a list of points on the plane. Find the K closest points to the origin (0, 0). (Here, the distance between two points on a plane is the Euclidean distance.) You may return the answer in any order. The…

Leetcode Medium

4 min read

K Closest Points to Origin — Leetcode Medium
K Closest Points to Origin — Leetcode Medium

Jan 4, 2021

Repeated Substring Pattern: Leetcode tough KMP and Robin Karp Algorithm

https://leetcode.com/problems/repeated-substring-pattern/ Easy But tough for me as I do not know two of the algorithms 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. …

Kmp Algorithm

7 min read

Repeated Substring Pattern: Leetcode Medium problem not EASY KMP and Robin Kare
Repeated Substring Pattern: Leetcode Medium problem not EASY KMP and Robin Kare

Jan 4, 2021

Decoded String at Index : Array + math

Medium — Leetcode: https://leetcode.com/problems/decoded-string-at-index/solution/ An encoded string S is given. To find and write the decoded string to a tape, the encoded string is read one character at a time and the following steps are taken: If the character read is a letter, that letter is written onto the tape. …

Leetcode Medium

3 min read


Jan 2, 2021

Populating Next Right Pointers in Each Node

Medium(https://leetcode.com/problems/populating-next-right-pointers-in-each-node/submissions/) You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition: struct Node { int val; Node *left; Node *right; Node *next; } Populate each next pointer to point to its next…

Level Order Traversal

3 min read

Populating Next Right Pointers in Each Node
Populating Next Right Pointers in Each Node

Jan 2, 2021

OVERVIEW BFS, Recursive DFS with Example : Binary Tree Right Side View

Medium : https://leetcode.com/problems/binary-tree-right-side-view/ Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. Example: Input: [1,2,3,null,5,null,4] Output: [1, 3, 4] Explanation: 1 <--- / \ 2 3 <--- \ \ 5 4 <--- …

Recursive

4 min read

Binary Tree Right Side View- BFS,
Binary Tree Right Side View- BFS,

Jan 1, 2021

LevelOrderTraversal : Symmetric Tree

Iterative — Easy : https://leetcode.com/problems/symmetric-tree/ Recursive — Medium [ very important and intuitive] Hint : 1. A Tree is symmetric to itself. So if you implement a function which accepts two trees to check for symmetry, you can start the first call of the function with symmetric(root, root). Problem Statement: …

Symmetric Tree

3 min read

LevelOrderTraversal : Symmetric Tree
LevelOrderTraversal : Symmetric Tree

Jan 1, 2021

Sum of left children — Preorder traversal

Easy Sum of Left Leaves Easy : https://leetcode.com/problems/sum-of-left-leaves/ Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24. Iterative Code: #…

Preorder Traversal

2 min read


Jan 1, 2021

Binary Tree Zigzag Level Order Traversal

Medium- Hard, https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal/solution/ Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate between). During interview: Its good to point out the differences in the space complexity of the BFS (using…

Zigzag Traversal

4 min read


Jan 1, 2021

Tree : Generate the Top- View of BST

Following the previous post on BF traversal of BSTrees, here is another cool problem often can be easily described using two different data structures. A dictionary and a Tree at play. Please read along .. Problem Top view of a binary tree is the set of nodes visible when the tree…

Levelordertraversal

3 min read


Jan 1, 2021

Tree : Level-Order-Traversal or Breath-First-Search

In this post, I will summarize a Binary’s Search Trees (BST)s, level order traversal. I picked this problem from HackerRank Site and feel like, its been touch based so much every where it needs a place where the problem and solution can be easily searched and read. …

Bst

6 min read

Technical Interviews Preparation

Technical Interviews Preparation

Currently preparing for interviews

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Knowable