Algorithms – Medium

Medium level algorithm and data structure challenges.

Add Two Numbers
Challenge: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
Topics Covered: Linked List

Binary Tree Inorder Traversal
Challenge: Given a binary tree, return the inorder traversal of its nodes’ values.
Topics Covered: Recursion, Tree

Container With Most Water
Challenge: Given array of pylon heights, find max area of water in between.
Topics Covered: Array, Two Pointer

Merge Intervals
Challenge: Given a collection of intervals, merge all overlapping intervals.
Topics Covered: Array, Sort

Odd Even Linked List
Challenge: Given a binary tree, determine if it is a valid binary search tree (BST).
Topics Covered: Linked List

Product of Array Except Self
Challenge: Given an array nums of n integers where n > 1, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].
Topics Covered: Array, Dynamic Programming

Remove Nth Node From End of List
Challenge: Given a linked list, remove the n-th node from the end of list and return its head.
Topics Covered: Linked List

Subsets
Challenge: Given a set of distinct integers, nums, return all possible subsets (the power set).
Topics Covered: Array

Top K Frequent Elements
Challenge: Given a non-empty array of integers, return the k most frequent elements.
Topics Covered: Hash Table, Array, Sort

Trapping Rain Water
Challenge: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
Topics Covered: Array, Dynamic Programming

Unique Paths
Challenge: How many possible unique paths are there?
Topics Covered: Array, Dynamic Programming

Validate Binary Search Tree
Challenge: Given a binary tree, determine if it is a valid binary search tree (BST).
Topics Covered: Binary Tree, DFS