Given a string of lowercase characters, reorder them such that the same characters are at least distance d from each other.

# Printing Matrix (2D array) in Spiral Order

Given a matrix (2D array) of m x n elements (m rows, n columns), write a function that prints the elements in the array in a spiral manner.

# Finding prime numbers

Output all prime numbers up to a specified integer n.

# Maximum Height (Depth) of a Binary Tree

Given a binary tree, find its maximum height.

# Binary Search Tree In-Order Traversal Iterative Solution

Given a binary search tree, print the elements in-order iteratively without using recursion.

# Multiplication of numbers

There is an array A[N] of N numbers. You have to compose an array Output[N] such that Output[i] will be equal to multiplication of all the elements of A[N] except A[i]. Solve it without division operator and in O(n).

# Hacking a Google interview (From MIT)

Google interview is so popular that even MIT dedicates a course to it! » Hacking a Google Interview Course Website

# Rotating an array in place

Rotate a one-dimensional array of n elements to the right by k steps. For instance, with n=7 and k=3, the array {a, b, c, d, e, f, g} is rotated to {e, f, g, a, b, c, d}.

# Searching an Element in a Rotated Sorted Array

Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). How do you find an element in the rotated array efficiently? You may assume no duplicate exists in the array.

# Finding all unique triplets that sums to zero

Given a set S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the set which gives the sum of zero.

# How to determine if a point is inside a rectangle?

Given a 2D point and a rectangle, determine if the point is inside the rectangle.

# Reversing linked list iteratively and recursively

Implement the reversal of a singly linked list iteratively and recursively.

# Finding intersection of two sorted arrays

Find the intersection of two sorted arrays.

# A binary tree problem – Populating next right pointers in each node

Given a binary tree

1 2 3 4 5 |
struct Node { Node* leftChild; Node* rightChild; Node* nextRight; } |

Populate the nextRight pointers in each node.

# Recursion to the rescue!

Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal.

# C code to count the number of words in a string

Count the number of words in a string, where a word is defined to be a contiguous sequence of non-space characters.

# C code to remove spaces from a string

Write a C function to remove spaces from a string. The function header should be void removeSpaces(char *str)

# Interview tips for programmers

If you are majoring in Computer Science, chances are you’ll be working with jobs that require some degree of programming. When you’re looking for a job in the market, you’ll be having a lot of interviews. Interviewer loves to challenge you by asking some technical interview questions.