# Author Archives ### Arpan Das

SDE II Amazon
Bengaluru, Karnataka, India

## Maximum Subarray Sum

Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.

## Count Complete Tree Nodes

Given a Complete Binary Tree, count the number of nodes. Definition of a Complete Binary Tree: In a Complete Binary Tree every level, except possibly the last, is completely filled, and all […]

## K Closest Points to Origin

Given a list of points on the plane. Find the K closest points to the origin (0, 0). The distance between two points on a plane is the Euclidean Distance.

## Next Closest Time

Given a time represented in the format “HH:MM”, Form the next closest time by reusing the current digits. There is no limit on how many times a digit can be reused. You may assume the given input string is always valid. For example, “01:34”, “12:09” are all valid. “1:34”, “12:9” are all invalid.

## Maximum Number of Events That Can Be Attended

Let’s say we had a calendar for a four day week. The calendar is full of events, which each can span multiple days. Each color block represents an event:

## Search for a target value in a 2D Matrix

Write an efficient algorithm that searches for a value in an m x n matrix

## Maximum Frequency Stack (MFS)

Implement a Maximum Frequency Stack (MFS), a class that simulates the operation of a stack-like data structure.

## Given a binary tree, return all root-to-leaf paths.

Given a binary tree, return all root-to-leaf paths.A leaf is a node with no children.

## Binary Tree Zigzag Level Order Traversal

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).

## Search in Rotated Sorted Array

You have given a rotated array sorted in ascending order. The array is rotated at some unknown pivot point. The array [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]. You are given a target value to search. If found in the array return its index, otherwise return -1