# Author Archives ### Arpan Das

SDE II Amazon
Bengaluru, Karnataka, India

## Serialize and Deserialize n-ary tree

Given an N-ary Tree, Serialize and Deserialize it. Serialization is a basically a representation of a tree in a String format which takes much lesser space than storing the tree itself. Deserialization is constructing the actual tree using the serialized format of the tree.

## Verifying an Alien Dictionary

In an alien language, surprisingly they also use english lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters.

## Merge Two Sorted Linked Lists

Write a merge function that takes two lists, each of which is sorted in increasing order, and merges the two together into one list which is in increasing order.

## Spiral Matrix II

Given a positive integer n, generate an n x n matrix filled with elements from 1 to n2 in spiral order.

## Spiral Matrix

Given an m x n matrix, return all elements of the matrix in spiral order. The Spiral Matrix problem takes a 2-Dimensional array of N-rows and M-columns as an input, and prints the elements of this matrix in spiral order.

## Max Points on a Line

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.

## Happy Number

In number theory, a happy number is a number which eventually reaches 1 when replaced by the sum of the square of each digit.

## Next Greater Element I

You are given two integer arrays nums1 and nums2 both of unique elements, where nums1 is a subset of nums2. Find all the next greater numbers for nums1’s elements in the corresponding places of nums2. The Next Greater Number of a number x in nums1 is the first greater number to its right in nums2. If it does not exist, return -1 for this number.

## Single Element in a Sorted Array

You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once. Find this single element that appears only once.

## Search a 2D Matrix II

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