## Queue

###### Queue

Fundamentals A type of linear data structure Queues’ operations are subset of Arrays Can only add element (tail) from one end and remove element from the other end (head) First in First out

## Stack

###### Stack

Fundamentals Implementation I will implement a stack with the help of the dynamic array I built before Dynamic Array Code class Array: def init(self, arr=None, capacity=10): if isinstanc

## 347. Top K Frequent Elements

###### 347. Top K Frequent Elements

Problem Given a non-empty array of integers, return the k most frequent elements. Example 1: Input: nums = [1,1,1,2,2,3], k = 2 Output: [1,2] Example 2: Input: nums = , k = 1 Output:  Note: Y

## 112. Path Sum

###### 112. Path Sum

Problem Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. Note: A leaf is a node with no children. Ex

## 220. Contains Duplicate III

###### 220. Contains Duplicate III

Problem Given an array of integers, find out whether there are two distinct indices i and j in the array such that the absolute difference between nums[i] and nums[j] is at most t and the absolute dif

## Dynamic Array

###### Dynamic Array

Dynamic Array In Array, I pre-defined the capacity The array’s size need to be smaller than its capacity Now I will define a dynamic array whose capacity will grow or shrink depending on array&

## 257. Binary Tree Paths

###### 257. Binary Tree Paths

Problem Given a binary tree, return all root-to-leaf paths. Note: A leaf is a node with no children. Example: Input: 1 / \ 2 3 \ 5 Output: ["1->2->5", "1->3"] Explanation: