Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
SDE II Amazon
Bengaluru, Karnataka, India
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 […]
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.
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.
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:
Write an efficient algorithm that searches for a value in an m x n matrix
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.A leaf is a node with no children.
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).
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