Subscribe to get weekly content on data structures and algorithms, machine learning, system design, and oops.

Industry Focused

Interview Focused

Interest Focused

We design interview and industry-centric content with in-depth explanations and help learners develop a dedicated interest in computer science, coding, mathematics and problem-solving. Enjoy coding, enjoy problem-solving.

Find Intersection of Two Arrays

Given two integer arrays, X[] and Y[] of size m and n, write a program to find intersection of these two arrays. The intersection is a list of common elements present in both arrays. Suppose m > n, all array elements are distinct and intersection elements can be in any order. Note: This is an excellent problem to learn problem solving using various approaches.

Climbing Stairs Problem

There is a staircase of n steps, and you can climb either 1 or 2 steps at a time. Write a program to count and return the number of unique ways to climb the nth stair. The order of steps taken matters. Note: Climbing stairs is an excellent problem to learn dynamic programming approach and application of the Fibonacci series in problem-solving.

Find First and Last Position of Element in Sorted Array

Given an array of integers sorted in ascending order, write a program to find the first and last occurrence of a given element. Our goal should be to design an algorithm with O(log n) time complexity. Note: This is an excellent question to learn problem-solving using binary search. Here we need to apply binary search twice to solve this problem.

Remove nth node from end of list

The head pointer of a linked list is given, write a program to remove the Nth node from the end of the linked list and return its head. In other words, when the node is traversed from the end we have to delete the Nth node from there. Note: This is an excellent problem for beginners to learn problem solving using two pointers in a linked list.

Lower Bound of Comparison Based Sorting

Sorting algorithms like merge sort, quicksort, insertion sort, heap sort, etc., determine sorted order based on comparison operations. We call such algorithms comparison sort. The tightest lower bound on the number of comparisons performed by comparison based sorting is O(nlogn). In this blog, we have used a decision tree model to prove this.

Operator Overloading in C++

Operator overloading is a compile time polymorphism that allows us to extend the meaning of an operator to operate on a user-defined data type. The main advantage of operator overloading is that we can have different implementations of an operator based on the argument type. Here we will learn how to implement and overload various operators.