Snippets
Browse collection of some of my coding snippets 😉
Array Intersection
Write a function called arrayIntersection that takes in two arrays and returns an array containing the intersection of the two input arrays (i.e., the common elements that appear in both arrays).
Binary Tree Level Order Traversal
Since we need to traverse all nodes of each level before moving onto the next level, we can use the Breadth First Search (BFS) technique to solve this problem.
Calculate Power Using Recursion
The power of a number is the number multiplied to itself for the number of times it has been raised to
Calculator
Write a function called calculator that takes in 2 numbers and an operator and returns the result of the calculation.
Collection of Important Links
Useful links
Count Occurrences
Write a function called countOccurrences() that takes in a string and a character and returns the number of occurrences of that character in the string.
css
Common CSS Technical Questions
CSS Interview Questions
List of common questions asked in interview
Factorial of Number Using Recursion
The factorial of a number is the product of all the numbers from 1 to that number.
Fibonacci Number
Time Complexity O(n)/Space Complexity O(1)
git
Common GIT Technical Questions
html
Common HTML Technical Questions
javascript
Common JavaScript Technical Questions
JavaScript Array Methods
These methods cover a wide range of operations you can perform on arrays
JavaScript Interview Questions
List of common questions asked in interview
JavaScript String Methods
These methods cover a wide range of operations you can perform on strings
Kth Largest Element in an Array
MinHeap class and the findKLargestNumbers function implement a priority queue using a min-heap data structure.
Linked List Cycle
Time Complexity O(n)/Space Complexity O(1)
Merge Two Sorted Lists
Time Complexity O(m+n)/Space Complexity O(1)
Program to Display Fibonacci Sequence Using Recursion
A Fibonacci sequence is the integer sequence of 0, 1, 1, 2, 3, 5, 8....
React Interview Questions
List of common questions asked in interview
reactjs
Common REACTJS Technical Questions
Title Case
Write a function called titleCase that takes in a string and returns the string with the first letter of each word capitalized.
Topological Ordering
Topological Sort of a directed graph (a graph with unidirectional edges) is a linear ordering of its vertices such that for every directed edge (U, V) from vertex U to vertex V, U comes before V in the ordering.
useLayoutEffect
Both of these can be used to do basically the same thing, but they have slightly different use cases.
Using recursion to determine whether a word is a palindrome
A palindrome is a word that is spelled the same forward and backward. For example, rotor is a palindrome, but motor is not.